Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is Java. I need the PSEUDOCODE (or) FLOWCHART for the following source code. SOURCE CODE : CourseGradeDemo.java public class CourseGradeDemo { public static void

This is Java. I need the PSEUDOCODE (or) FLOWCHART for the following source code.

SOURCE CODE:

CourseGradeDemo.java

public class CourseGradeDemo { public static void main(String args[]) { GradedActivity lab = new GradedActivity(); lab.setScore(85); PassFailExm pfExm=new PassFailExm(20,3,70); Essay essay=new Essay(); essay.setEssayvalues(25,18,17,20); FinalExm finalExm=new FinalExm(50,10); CourseGrades course=new CourseGrades(); course.setLab(lab); course.setPassFailExm(pfExm); course.setEssay(essay); course.setFinalExm(finalExm); System.out.println(course); }

}

--------------------------------------------------------

CourseGrades.java

import java.util.Arrays;

public class CourseGrades { private GradedActivity ga[] = new GradedActivity[4];

public void setLab(GradedActivity lab) { ga[0]=new GradedActivity(); ga[0].setScore(lab.getScore()); }

public void setPassFailExm(PassFailExm pfe) { ga[1]=new GradedActivity(); ga[1].setScore(pfe.getScore()); }

public void setEssay(Essay e) { ga[2]=new GradedActivity(); ga[2].setScore(e.getScore()); }

public void setFinalExm(FinalExm fe) { ga[3]=new GradedActivity(); ga[3].setScore(fe.getScore()); }

/* * (non-Javadoc) * * @see java.lang.Object#toString() */ @Override public String toString() { String s = new String("Lab Score :" + ga[0].getScore() + " Grade:" + ga[0].getLetterGrade() + " Pass/Fail Exm Score :" + ga[1].getScore() + " Grade:" + ga[1].getLetterGrade() + " Essay Score :" + ga[2].getScore() + " Grade:" + ga[2].getLetterGrade() + " Final Exm Score:" + ga[3].getScore() + " Grade:" + ga[3].getLetterGrade()); return s; }

}

Essay.java

public class Essay extends GradedActivity { private int grammerPoints; private int spellingPoints; private int lengthPoints; private int contentPoints;

public Essay() { this.grammerPoints = 0; this.spellingPoints = 0; this.lengthPoints = 0; this.contentPoints = 0; }

public Essay(int grammerPoints, int spellingPoints, int lengthPoints, int contentPoints) { this.grammerPoints = grammerPoints; this.spellingPoints = spellingPoints; this.lengthPoints = lengthPoints; this.contentPoints = contentPoints; }

public void setEssayvalues(int grammerPoints, int spellingPoints, int lengthPoints, int contentPoints) { this.grammerPoints = grammerPoints; this.spellingPoints = spellingPoints; this.lengthPoints = lengthPoints; this.contentPoints = contentPoints; int tot = grammerPoints + spellingPoints + lengthPoints + contentPoints; super.setScore(tot); }

public int getGrammerPoints() { return grammerPoints; }

public int getSpellingPoints() { return spellingPoints; }

public int getLengthPoints() { return lengthPoints; }

public int getContentPoints() { return contentPoints; }

public double getTotalScore() { int tot = 0; tot = grammerPoints + spellingPoints + lengthPoints + contentPoints; return tot; }

}

FinalExm.java

public class FinalExm extends GradedActivity { private int numQuestions; // Number of questions private double pointsEach; // Points for each question private int numMissed; // Questions missed

/** * The constructor sets the number of questions on the Exm and the number * of questions missed. * * @param questions * The number of questions. * @param missed * The number of questions missed. */

public FinalExm(int questions, int missed) { double numericScore; // To hold a numeric score

// Set the numQuestions and numMissed fields. numQuestions = questions; numMissed = missed;

// Calculate the points for each question and // the numeric score for this Exam. pointsEach = 100.0 / questions; numericScore = 100.0 - (missed * pointsEach);

// Call the inherited setScore method to // set the numeric score. setScore(numericScore); }

/** * The getPointsEach method returns the number of points each question is * worth. * * @return The value in the pointsEach field. */

public double getPointsEach() { return pointsEach; }

/** * The getNumMissed method returns the number of questions missed. * * @return The value in the numMissed field. */

public int getNumMissed() { return numMissed; } }

GradedActivity.java

public class GradedActivity { private double score;

public GradedActivity() { score = 0.0; }

public GradedActivity(double s) { score = s; }

public void setScore(double s) { score = s; }

public double getScore() { return score; }

public char getLetterGrade() { char letterGrade; if (score > 89) letterGrade = 'A'; else if (score > 79) letterGrade = 'B'; else if (score > 69) letterGrade = 'C'; else if (score > 59) letterGrade = 'D'; else letterGrade = 'F'; return letterGrade; } }

Lab.java

public class Lab extends GradedActivity

{ /** * @param score */ public Lab(int score) { super(score); }

public void setScore(double sc) { super.setScore(sc); }

public double getScore() { return super.getScore(); }

}

PassFailExm.java

public class PassFailExm extends GradedActivity {

private int numQuestions; // Number of questions private double pointsEach; // Points for each question private int numMissed; // Number of questions missed

/** The constructor sets the number of questions, the number of questions missed, and the minimum passing score. @param questions The number of questions. @param missed The number of questions missed. @param minPassing The minimum passing score. */

public PassFailExm(int questions, int missed, double minPassing) { // Call the superclass constructor. super(minPassing);

// Declare a local variable for the score. double numericScore;

// Set the numQuestions and numMissed fields. numQuestions = questions; numMissed = missed;

// Calculate the points for each question and // the numeric score for this Exm. pointsEach = 100.0 / questions; numericScore = 100.0 - (missed * pointsEach);

// Call the superclass's setScore method to // set the numeric score. setScore(numericScore); }

/** The getPointsEach method returns the number of points each question is worth. @return The value in the pointsEach field. */

public double getPointsEach() { return pointsEach; }

/** The getNumMissed method returns the number of questions missed. @return The value in the numMissed field. */

public int getNumMissed() { return numMissed; } }

Please help. Thank you!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

More Books

Students also viewed these Databases questions