public class GradeActivity { // declaring the variable scoreValue private double
ID: 3574646 • Letter: P
Question
public class GradeActivity
{
// declaring the variable scoreValue
private double scoreValue;
//setter to set a value for the scoreValue
public void setScore(double s1)
{
//setting value
scoreValue = s1;
}
//getter to get score
public double getScoreOf()
{
// return statement
return scoreValue;
}
//getter to get grade
public char getGradeOf()
{
//variable declaration
char letterGrade;
//checking each scoreValue to get a letter grade
if (scoreValue >= 90)
letterGrade = 'A';
else if (scoreValue >= 80)
letterGrade = 'B';
else if (scoreValue >= 70)
letterGrade = 'C';
else if (scoreValue >= 60)
letterGrade = 'D';
else
letterGrade ='F';
//return statement
return letterGrade;
}
}
--------------------------------------------------------------------------------
public class PassFailExam extends PassFailActivity
{
//Number of question
private int numOfQuestions;
//points for each question
private double pointsOfEach;
//Number of questions missed
private int numOfMissed;
//parameterised constructor which is passing Questions, missed and minPassing
public PassFailExam(int questions, int missed , double minPassing)
{
//call the superclass contructor
super (minPassing);
// Declare a local variable for the score
double numericScoreValue;
//set the numQuestions and numMissed fields
numOfQuestions = questions;
numOfMissed = missed;
pointsOfEach =100.0 /questions;
numericScoreValue = 100.0 - (missed * pointsOfEach);
// call the superclass's setScore method to
// set the numeric score
setScore(numericScoreValue);
}// Get method to get each points
public double get getPointOfEach()
{
//return statement
return pointsOfEach;
//Get method to get mummissed
public int getNumOfMissed()
{
//return statement
return numOfMissed;
}
}
-------------------------------------------------------------------------------
public class FinalExam extends GradeActivity
{
//Number of questions
private int numOfQuestions;
//points for each question
private double pointsOfEach;
//Questions missed
private int numOfMissed;
//Constructor for the class FinalEaxam
public FinalExam( int questions, int missed)
{
// To hold a numeric score
double numericsScoreValue;
// set the numQuestions and numMissed field
numOfQuestions = questions;
numOfMissed = missed;
// the numericscore for this exam
pointsOfEach = 100.0/questions;
numericScoreValue = 100.0- (missed * pointsOfEach);
//Call the inherited setScore method to
//set the numeric score
setScore(numericScoreValue);
// Get method to get each points
public double getPointsOfEach()
{
//return statement
return pointsOfEach;
}
// Get method to get nummissed
public int getNumOfMissed()
{
//return statement
return numOfMissed;
}
}
----------------------------------------------------------------------------------------
public class Essay extends GradeActivity
{
private int grammars;
private int spellings;
private int correctLengths;
private int contents;
/* the following constructor sets the points for grammar, spelling, correct length, content, and score.*/
// parameterized constructor
public Essay(int egrammar, int espelling, int ecorrectLength, int econtent)
{
grammars = egrammar;
spellings = espelling;
correctLengths = ecorrectLength;
contents = econtent;
setScore(grammars + spellings + correctLengths + contents);
/* the following getFrammar method returns the number of grammar points.*/
//getGrammar method implementation
public int getGrammar()
{
return grammars;
}//end of getSpelling method returns the number of spelling points.*/
/* the following getSpelling method returns the number of spelling point*/
//getSpelling method implementation
public int getSpelling ()
{
return spellings;
}
/* the following get Correct length method returns the number of correct length points .*/
//getCorrectLegth method implementation
public int getCorrectLength()
{
return correctLengths;
}
public int getContent()
{
return contents;
}
}
------------------------------------------------------------------------------------------
public class CourseGrades
{
/*create an array named grades of four GradeActivity objects*/
private final GradedActivity[] grades= new GradedActivity[4];
/* the following setlab method accepts a GradeActivity object as a parameter and then stores this object in the grades array as the 0th element.*/
// setlab mehod implementtation
public void setLab (GradedActivity ga)
{
grades[0] = ga;
}
public void setPassFailExam(PassFailExam pfe)
{
grades[1] = pfe;
}
public void setEssay(Essay e)
{
grades[2]=e;
}
public void setFinalExam(FinalExam fe)
{
grades[3]=fe;
}
public String toString()
{
return "Lab: "
+ " Score: " + grades[0].getScoreOf()
+ " Grade: " + grades[0].getGradeOf()
+ " PassFailExam: "
+ " Score: " + grades[1].getScoreOf()
+ " Grade: " + grades[1].getGradeOf()
+" Essay: "
+" Score: " + grades[2].getScoreOf()
+" Grade: " + grades[2].getGradeOf()
+" FilanExam: "
+" Score: " + grades[3].getScoreOf()
+" ,Grade:" + grades[3].getGradeOf()
}
public double getAverge()
{
double total = 0;
for (int i = 0; i < grades.length;i++)
{
total += grades[i].getScore();
}
double average = total/ grades.length;
return average;
}
public GradeActivity getHighest()
{
GradeActivity highest =grades[0];
for (int i =0;i< grades.length ; i++)
{
if (grades[i].getScore() > highest.getScore())
highest=grades[i];
}
return highest;
}
//GetLowest method implementation
public GradeActivity get Lowest()
{
GradedActivity lowest =grades[0];
for (int i = 0; i < grades.length;i++)
{
if (grades[i].getScore()<lowest.getScore())
lowest = grades[i];
}
return lowest;
}
}
----------------------------------------------------------------------------
public class CourseGradeDemo
{
//start main method
public static void main(String[]args)
{
//create an object for the GradeActivity class
GradeActivity ga = new GradeActivity();
//set Score of the GradeActivity
ga.setScore(80);
//Create an object for the PassFailExam class
PassFailExam pfe= new PassFailExam(10,3,70);
//create an object for the Essay class
Essay e = new Essay(28,19,18,29);
//create an object for the CourseGrades class
CourseGrades coursegrade = new CourseGrades();
//create a object for the FinalExam class
FinalExam fe = new FinalExam(50,12);
/*call the "setLab" method with the GradedActivity object*/
coursegrade.setLab(ga);
/*call the "setPassFailExam" method with the PassFailExamobject*/
coursegrade.setPassFailExam(pfe);
/*call the "setEssay" method with the Essay object */
coursegrade.setEssay(e);
/*call the "setFinalExam" method with the FinalExamobject */
coursegrade.setFinalExam(fe);
//call the "toString" method of courseGrade
System.out.println(coursegrade);
}
}
--------------------------------------------------------------
public interface Analyzable
{
double getAverage();
GradedActivity getHighest();
GradedActivity getLowest();
}
------------------------------------------------------------------------
I created my coding. but it had a lot of errors can you help me to fix them to run. it my final
ant -f "C:\Users\chau nguyen bao\Documents\NetBeansProjects\PassFailExam" -Dnb.internal.action.name=build jar
init:
Deleting: C:Userschau nguyen baoDocumentsNetBeansProjectsPassFailExamuilduilt-jar.properties
deps-jar:
Updating property file: C:Userschau nguyen baoDocumentsNetBeansProjectsPassFailExamuilduilt-jar.properties
Compiling 1 source file to C:Userschau nguyen baoDocumentsNetBeansProjectsPassFailExamuildclasses
C:Userschau nguyen baoDocumentsNetBeansProjectsPassFailExamsrcpassfailexamPassFailExam.java:32: error: ';' expected
public double get getPointOfEach()
C:Userschau nguyen baoDocumentsNetBeansProjectsPassFailExamsrcpassfailexamPassFailExam.java:32: error: invalid method declaration; return type required
public double get getPointOfEach()
C:Userschau nguyen baoDocumentsNetBeansProjectsPassFailExamsrcpassfailexamPassFailExam.java:38: error: illegal start of expression
public int getNumOfMissed()
C:Userschau nguyen baoDocumentsNetBeansProjectsPassFailExamsrcpassfailexamPassFailExam.java:38: error: ';' expected
public int getNumOfMissed()
C:Userschau nguyen baoDocumentsNetBeansProjectsPassFailExamsrcpassfailexamPassFailExam.java:43: error: reached end of file while parsing
}
5 errors
C:Userschau nguyen baoDocumentsNetBeansProjectsPassFailExam bprojectuild-impl.xml:930: The following error occurred while executing this line:
C:Userschau nguyen baoDocumentsNetBeansProjectsPassFailExam bprojectuild-impl.xml:270: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 3 seconds)
---------------------------------------------------------------------
in the Final Exam
ant -f "C:\Users\chau nguyen bao\Documents\NetBeansProjects\FinalExam" -Dnb.internal.action.name=build jar
init:
Deleting: C:Userschau nguyen baoDocumentsNetBeansProjectsFinalExamuilduilt-jar.properties
deps-jar:
Updating property file: C:Userschau nguyen baoDocumentsNetBeansProjectsFinalExamuilduilt-jar.properties
Compiling 1 source file to C:Userschau nguyen baoDocumentsNetBeansProjectsFinalExamuildclasses
C:Userschau nguyen baoDocumentsNetBeansProjectsFinalExamsrcFinalExam.java:31: error: illegal start of expression
public double getPointsOfEach()
C:Userschau nguyen baoDocumentsNetBeansProjectsFinalExamsrcFinalExam.java:31: error: ';' expected
public double getPointsOfEach()
C:Userschau nguyen baoDocumentsNetBeansProjectsFinalExamsrcFinalExam.java:39: error: illegal start of expression
public int getNumOfMissed()
C:Userschau nguyen baoDocumentsNetBeansProjectsFinalExamsrcFinalExam.java:39: error: ';' expected
public int getNumOfMissed()
C:Userschau nguyen baoDocumentsNetBeansProjectsFinalExamsrcFinalExam.java:44: error: reached end of file while parsing
}
5 errors
C:Userschau nguyen baoDocumentsNetBeansProjectsFinalExam bprojectuild-impl.xml:930: The following error occurred while executing this line:
C:Userschau nguyen baoDocumentsNetBeansProjectsFinalExam bprojectuild-impl.xml:270: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 2 seconds)
---------------------------------------------------------------------------
in the file essay
ant -f "C:\Users\chau nguyen bao\Documents\NetBeansProjects\FinalExam" -Dnb.internal.action.name=build jar
init:
Deleting: C:Userschau nguyen baoDocumentsNetBeansProjectsFinalExamuilduilt-jar.properties
deps-jar:
Updating property file: C:Userschau nguyen baoDocumentsNetBeansProjectsFinalExamuilduilt-jar.properties
Compiling 1 source file to C:Userschau nguyen baoDocumentsNetBeansProjectsFinalExamuildclasses
C:Userschau nguyen baoDocumentsNetBeansProjectsFinalExamsrcFinalExam.java:31: error: illegal start of expression
public double getPointsOfEach()
C:Userschau nguyen baoDocumentsNetBeansProjectsFinalExamsrcFinalExam.java:31: error: ';' expected
public double getPointsOfEach()
C:Userschau nguyen baoDocumentsNetBeansProjectsFinalExamsrcFinalExam.java:39: error: illegal start of expression
public int getNumOfMissed()
C:Userschau nguyen baoDocumentsNetBeansProjectsFinalExamsrcFinalExam.java:39: error: ';' expected
public int getNumOfMissed()
C:Userschau nguyen baoDocumentsNetBeansProjectsFinalExamsrcFinalExam.java:44: error: reached end of file while parsing
}
5 errors
C:Userschau nguyen baoDocumentsNetBeansProjectsFinalExam bprojectuild-impl.xml:930: The following error occurred while executing this line:
C:Userschau nguyen baoDocumentsNetBeansProjectsFinalExam bprojectuild-impl.xml:270: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 2 seconds)
----------------------------------------------------------------
in the file of CourseGrade
ant -f "C:\Users\chau nguyen bao\Documents\NetBeansProjects\JavaApplication20" -Dnb.internal.action.name=build jar
init:
Deleting: C:Userschau nguyen baoDocumentsNetBeansProjectsJavaApplication20uilduilt-jar.properties
deps-jar:
Updating property file: C:Userschau nguyen baoDocumentsNetBeansProjectsJavaApplication20uilduilt-jar.properties
Compiling 2 source files to C:Userschau nguyen baoDocumentsNetBeansProjectsJavaApplication20uildclasses
C:Userschau nguyen baoDocumentsNetBeansProjectsJavaApplication20srcCourseGrades.java:40: error: ';' expected
+" ,Grade:" + grades[3].getGradeOf()
C:Userschau nguyen baoDocumentsNetBeansProjectsJavaApplication20srcCourseGrades.java:65: error: ';' expected
public GradeActivity get Lowest()
C:Userschau nguyen baoDocumentsNetBeansProjectsJavaApplication20srcCourseGrades.java:65: error: invalid method declaration; return type required
public GradeActivity get Lowest()
3 errors
C:Userschau nguyen baoDocumentsNetBeansProjectsJavaApplication20 bprojectuild-impl.xml:930: The following error occurred while executing this line:
C:Userschau nguyen baoDocumentsNetBeansProjectsJavaApplication20 bprojectuild-impl.xml:270: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 7 seconds)
-------------------------------------------------------
in the file of courseGradeDemo
ant -f "C:\Users\chau nguyen bao\Documents\NetBeansProjects\CourseGradeDemo" -Dnb.internal.action.name=build jar
init:
Deleting: C:Userschau nguyen baoDocumentsNetBeansProjectsCourseGradeDemouilduilt-jar.properties
deps-jar:
Updating property file: C:Userschau nguyen baoDocumentsNetBeansProjectsCourseGradeDemouilduilt-jar.properties
Compiling 2 source files to C:Userschau nguyen baoDocumentsNetBeansProjectsCourseGradeDemouildclasses
C:Userschau nguyen baoDocumentsNetBeansProjectsCourseGradeDemosrcCourseGradeDemo.java:7: error: cannot find symbol
GradeActivity ga = new GradeActivity();
symbol: class GradeActivity
location: class CourseGradeDemo
C:Userschau nguyen baoDocumentsNetBeansProjectsCourseGradeDemosrcCourseGradeDemo.java:7: error: cannot find symbol
GradeActivity ga = new GradeActivity();
symbol: class GradeActivity
location: class CourseGradeDemo
C:Userschau nguyen baoDocumentsNetBeansProjectsCourseGradeDemosrcCourseGradeDemo.java:13: error: cannot find symbol
PassFailExam pfe= new PassFailExam(10,3,70);
symbol: class PassFailExam
location: class CourseGradeDemo
C:Userschau nguyen baoDocumentsNetBeansProjectsCourseGradeDemosrcCourseGradeDemo.java:13: error: cannot find symbol
PassFailExam pfe= new PassFailExam(10,3,70);
symbol: class PassFailExam
location: class CourseGradeDemo
C:Userschau nguyen baoDocumentsNetBeansProjectsCourseGradeDemosrcCourseGradeDemo.java:16: error: cannot find symbol
Essay e = new Essay(28,19,18,29);
symbol: class Essay
location: class CourseGradeDemo
C:Userschau nguyen baoDocumentsNetBeansProjectsCourseGradeDemosrcCourseGradeDemo.java:16: error: cannot find symbol
Essay e = new Essay(28,19,18,29);
symbol: class Essay
location: class CourseGradeDemo
C:Userschau nguyen baoDocumentsNetBeansProjectsCourseGradeDemosrcCourseGradeDemo.java:22: error: cannot find symbol
FinalExam fe = new FinalExam(50,12);
symbol: class FinalExam
location: class CourseGradeDemo
C:Userschau nguyen baoDocumentsNetBeansProjectsCourseGradeDemosrcCourseGradeDemo.java:22: error: cannot find symbol
FinalExam fe = new FinalExam(50,12);
symbol: class FinalExam
location: class CourseGradeDemo
8 errors
C:Userschau nguyen baoDocumentsNetBeansProjectsCourseGradeDemo bprojectuild-impl.xml:930: The following error occurred while executing this line:
C:Userschau nguyen baoDocumentsNetBeansProjectsCourseGradeDemo bprojectuild-impl.xml:270: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 2 seconds)
-------------------------------------------------------------------
in the file of Analyzable
ant -f "C:\Users\chau nguyen bao\Documents\NetBeansProjects\JavaApplication22" -Dnb.internal.action.name=build jar
init:
Deleting: C:Userschau nguyen baoDocumentsNetBeansProjectsJavaApplication22uilduilt-jar.properties
deps-jar:
Updating property file: C:Userschau nguyen baoDocumentsNetBeansProjectsJavaApplication22uilduilt-jar.properties
Compiling 1 source file to C:Userschau nguyen baoDocumentsNetBeansProjectsJavaApplication22uildclasses
C:Userschau nguyen baoDocumentsNetBeansProjectsJavaApplication22srcjavaapplication22Analyzable.java:4: error: cannot find symbol
GradedActivity getHighest();
symbol: class GradedActivity
location: interface Analyzable
C:Userschau nguyen baoDocumentsNetBeansProjectsJavaApplication22srcjavaapplication22Analyzable.java:5: error: cannot find symbol
GradedActivity getLowest();
symbol: class GradedActivity
location: interface Analyzable
2 errors
C:Userschau nguyen baoDocumentsNetBeansProjectsJavaApplication22 bprojectuild-impl.xml:930: The following error occurred while executing this line:
C:Userschau nguyen baoDocumentsNetBeansProjectsJavaApplication22 bprojectuild-impl.xml:270: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 2 seconds)
-------------------------------------------------------------------
help me
Explanation / Answer
//Modified code
//GradeActivity.java
public class GradeActivity
{
// declaring the variable scoreValue
private double scoreValue;
//setter to set a value for the scoreValue
public void setScore(double s1)
{
//setting value
scoreValue = s1;
}
//getter to get score
public double getScoreOf()
{
// return statement
return scoreValue;
}
//getter to get grade
public char getGradeOf()
{
//variable declaration
char letterGrade;
//checking each scoreValue to get a letter grade
if (scoreValue >= 90)
letterGrade = 'A';
else if (scoreValue >= 80)
letterGrade = 'B';
else if (scoreValue >= 70)
letterGrade = 'C';
else if (scoreValue >= 60)
letterGrade = 'D';
else
letterGrade ='F';
//return statement
return letterGrade;
}
}
-----------------------------------------------------------------------------------
//CourseGrades.java
public class CourseGrades
{
/*create an array named grades of four GradeActivity objects*/
private final GradeActivity[] grades= new GradeActivity[4];
/* the following setlab method accepts a GradeActivity object as a parameter and then stores this object in the grades array as the 0th element.*/
// setlab mehod implementtation
public void setLab (GradeActivity ga)
{
grades[0] = ga;
}
public void setPassFailExam(PassFailExam pfe)
{
grades[1] = pfe;
}
public void setEssay(Essay e)
{
grades[2]=e;
}
public void setFinalExam(FinalExam fe)
{
grades[3]=fe;
}
public String toString()
{
return "Lab: "
+ " Score: " + grades[0].getScoreOf()
+ " Grade: " + grades[0].getGradeOf()
+ " PassFailExam: "
+ " Score: " + grades[1].getScoreOf()
+ " Grade: " + grades[1].getGradeOf()
+" Essay: "
+" Score: " + grades[2].getScoreOf()
+" Grade: " + grades[2].getGradeOf()
+" FilanExam: "
+" Score: " + grades[3].getScoreOf()
+" ,Grade:" + grades[3].getGradeOf();
}
public double getAverge()
{
double total = 0;
for (int i = 0; i < grades.length;i++)
{
total += grades[i].getScoreOf();
}
double average = total/ grades.length;
return average;
}
public GradeActivity getHighest()
{
GradeActivity highest =grades[0];
for (int i =0;i< grades.length ; i++)
{
if (grades[i].getScoreOf() > highest.getScoreOf())
highest=grades[i];
}
return highest;
}
//GetLowest method implementation
public GradeActivity getLowest()
{
GradeActivity lowest =grades[0];
for (int i = 0; i < grades.length;i++)
{
if (grades[i].getScoreOf()<lowest.getScoreOf())
lowest = grades[i];
}
return lowest;
}
}
-----------------------------------------------------------------------------------
public class PassFailExam extends PassFailActivity
{
//Number of question
private int numOfQuestions;
//points for each question
private double pointsOfEach;
//Number of questions missed
private int numOfMissed;
//parameterised constructor which is passing Questions, missed and minPassing
public PassFailExam(int questions, int missed , double minPassing)
{
//call the superclass contructor
super (minPassing);
// Declare a local variable for the score
double numericScoreValue;
//set the numQuestions and numMissed fields
numOfQuestions = questions;
numOfMissed = missed;
pointsOfEach =100.0 /questions;
numericScoreValue = 100.0 - (missed * pointsOfEach);
// call the superclass's setScore method to
// set the numeric score
setScore(numericScoreValue);
}// Get method to get each points
public double getPointOfEach()
{
//return statement
return pointsOfEach;
}
//Get method to get mummissed
public int getNumOfMissed()
{
//return statement
return numOfMissed;
}
}
-----------------------------------------------------------------------------------
/**
This class holds a numeric score and determines
whether the score is passing or failing.
*/
//PassFailActivity.java
public class PassFailActivity extends GradeActivity
{
private double minPassingScore; // Minimum passing score
/**
The constructor sets the minimum passing score.
@param mps The minimum passing score.
*/
public PassFailActivity(double mps)
{
minPassingScore = mps;
}
/**
The getGrade method returns a letter grade
determined from the score field. This
method overrides the superclass method.
@return The letter grade.
*/
public char getGrade()
{
char letterGrade;
if (getScoreOf() >= minPassingScore)
letterGrade = 'P';
else
letterGrade = 'F';
return letterGrade;
}
}
-----------------------------------------------------------------------------------
//Essay.java
public class Essay extends GradeActivity
{
private int grammars;
private int spellings;
private int correctLengths;
private int contents;
/* the following constructor sets the points for grammar, spelling, correct length, content, and score.*/
// parameterized constructor
public Essay(int egrammar, int espelling, int ecorrectLength, int econtent)
{
grammars = egrammar;
spellings = espelling;
correctLengths = ecorrectLength;
contents = econtent;
double score=grammars+spellings+correctLengths+contents;
setScore(score);
}
/* the following getFrammar method returns the number of grammar points.*/
//getGrammar method implementation
public int getGrammar()
{
return grammars;
}//end of getSpelling method returns the number of spelling points.*/
/* the following getSpelling method returns the number of spelling point*/
//getSpelling method implementation
public int getSpelling ()
{
return spellings;
}
/* the following get Correct length method returns the number of correct length points .*/
//getCorrectLegth method implementation
public int getCorrectLength()
{
return correctLengths;
}
public int getContent()
{
return contents;
}
}
-----------------------------------------------------------------------------------
//FinalExam.java
public class FinalExam extends GradeActivity
{
//Number of questions
private int numOfQuestions;
//points for each question
private double pointsOfEach;
//Questions missed
private int numOfMissed;
//Constructor for the class FinalEaxam
public FinalExam( int questions, int missed)
{
// To hold a numeric score
double numericsScoreValue;
// set the numQuestions and numMissed field
numOfQuestions = questions;
numOfMissed = missed;
// the numericscore for this exam
pointsOfEach = 100.0/questions;
numericsScoreValue = 100.0- (missed * pointsOfEach);
//Call the inherited setScore method to
//set the numeric score
setScore(numericsScoreValue);
}
// Get method to get each points
public double getPointsOfEach()
{
//return statement
return pointsOfEach;
}
// Get method to get nummissed
public int getNumOfMissed()
{
//return statement
return numOfMissed;
}
}
-----------------------------------------------------------------------------------
//CourseGradeDemo.java
public class CourseGradeDemo
{
//start main method
public static void main(String[]args)
{
//create an object for the GradeActivity class
GradeActivity ga = new GradeActivity();
//set Score of the GradeActivity
ga.setScore(80);
//Create an object for the PassFailExam class
PassFailExam pfe= new PassFailExam(10,3,70);
//create an object for the Essay class
Essay e = new Essay(28,19,18,29);
//create an object for the CourseGrades class
CourseGrades coursegrade = new CourseGrades();
//create a object for the FinalExam class
FinalExam fe = new FinalExam(50,12);
/*call the "setLab" method with the GradedActivity object*/
coursegrade.setLab(ga);
/*call the "setPassFailExam" method with the PassFailExamobject*/
coursegrade.setPassFailExam(pfe);
/*call the "setEssay" method with the Essay object */
coursegrade.setEssay(e);
/*call the "setFinalExam" method with the FinalExamobject */
coursegrade.setFinalExam(fe);
//call the "toString" method of courseGrade
System.out.println(coursegrade);
}
}
----------------------------------------------------------------------------
//FinalExam.java
public class FinalExam extends GradeActivity
{
//Number of questions
private int numOfQuestions;
//points for each question
private double pointsOfEach;
//Questions missed
private int numOfMissed;
//Constructor for the class FinalEaxam
public FinalExam( int questions, int missed)
{
// To hold a numeric score
double numericsScoreValue;
// set the numQuestions and numMissed field
numOfQuestions = questions;
numOfMissed = missed;
// the numericscore for this exam
pointsOfEach = 100.0/questions;
numericsScoreValue = 100.0- (missed * pointsOfEach);
//Call the inherited setScore method to
//set the numeric score
setScore(numericsScoreValue);
}
// Get method to get each points
public double getPointsOfEach()
{
//return statement
return pointsOfEach;
}
// Get method to get nummissed
public int getNumOfMissed()
{
//return statement
return numOfMissed;
}
}
----------------------------------------------------------------------------
//Analyzable.java
public interface Analyzable
{
double getAverage();
GradeActivity getHighest();
GradeActivity getLowest();
}
----------------------------------------------------------------------------
Sample Output:
Lab:
Score: 80.0 Grade: B
PassFailExam:
Score: 70.0 Grade: C
Essay:
Score: 94.0 Grade: A
FilanExam:
Score: 76.0 ,Grade:C
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.