You will create an Essay class that inherits from the GradedActivity class. The Essay class should determine the grade a student receives on an essay. The essay score can be up to 100 points and is determined by the following: Grammar:  Spelling:  Correct Length:  Content:  You do not need to do any verification of the number of points. All you will do in the Essay class is to add up the four points and send it to GradedActivity. Start with the program GradedActivity.java. You could modify FinalExam.java Naming: Name the Java project: LastFProjectAssign08 Name the driver program (main): LastFAssign08.java  Where Last is your last name and F is the first initial of your first name. Ex: OgleD Call the essay class: Essay.java. Make sure you name, class, and date are comments in this file. Save in a file folder on your storage device. Sample output: What was the grammar score on the essay? 15 What was the spelling score on the essay? 10 What was the length score on the essay? 10 What was the content score on the essay? 50 The essay score is 85.0 The essay grade is B (((BELOW IS PROGRAM GRADEDACTIVITY.JAVA))) ** * A class that holds a grade for a graded activity. */ public class GradedActivity { private double score; // Numeric score /** * The setScore method stores its argument in * the score field. */ public void setScore(double s) { score = s; } /** * The getScore method returns the score field. */ public double getScore() { return score; } /** * The getGrade method returns a letter grade * determined from the score field. */ public char getGrade() { char letterGrade; // To hold the grade if (score >= 90) letterGrade = 'A'; else if (score >= 80) letterGrade = 'B'; else if (score >= 70) letterGrade = 'C'; else if (score >= 60) letterGrade = 'D'; else letterGrade = 'F'; return letterGrade; } } (((BELOW IS PROGRAM FILEEXAM.JAVA))) /** * This class determines the grade for a final exam. */ public class FinalExam extends GradedActivity { private int numQuestions; // Number of questions private double pointsEach; // Points for each question private int numMissed; // Number of questions missed /** * The constructor accepts as arguments the number * of questions on the exam and the number of * questions the student missed. */ public FinalExam(int questions, int missed) { double numericScore; // To calculate the 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 superclass's setScore method to // set the numeric score. setScore(numericScore); } /** * The getPointsEach method returns the pointsEach * field. */ public double getPointsEach() { return pointsEach; } /** * The getNumMissed method returns the numMissed * field.*/ public int getNumMissed() { return numMissed; } }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

You will create an Essay class that inherits from the GradedActivity class. The Essay class should determine the grade a student receives on an essay. The essay score can be up to 100 points and is determined by the following:

  • Grammar: 
  • Spelling: 
  • Correct Length: 
  • Content: 
  • You do not need to do any verification of the number of points.
  • All you will do in the Essay class is to add up the four points and send it to GradedActivity.

Start with the program GradedActivity.java. You could modify FinalExam.java

Naming:

  • Name the Java project: LastFProjectAssign08
  • Name the driver program (main): LastFAssign08.java 
  • Where Last is your last name and F is the first initial of your first name. Ex: OgleD
  • Call the essay class: Essay.java. Make sure you name, class, and date are comments in this file.
  • Save in a file folder on your storage device.

Sample output:

What was the grammar score on the essay? 15
What was the spelling score on the essay? 10
What was the length score on the essay? 10
What was the content score on the essay? 50
The essay score is 85.0
The essay grade is B

(((BELOW IS PROGRAM GRADEDACTIVITY.JAVA)))

** * A class that holds a grade for a graded activity.
*/
public class GradedActivity
{
private double score; // Numeric score

/** * The setScore method stores its argument in
* the score field. */
public void setScore(double s)
{
score = s;
}

/** * The getScore method returns the score field. */
public double getScore()
{
return score;
}

/** * The getGrade method returns a letter grade
* determined from the score field. */
public char getGrade()
{
char letterGrade; // To hold the grade
if (score >= 90)
letterGrade = 'A';
else if (score >= 80)
letterGrade = 'B';
else if (score >= 70)
letterGrade = 'C';
else if (score >= 60)
letterGrade = 'D';
else
letterGrade = 'F';

return letterGrade;
}
}

(((BELOW IS PROGRAM FILEEXAM.JAVA)))
/** * This class determines the grade for a final exam.
*/
public class FinalExam extends GradedActivity
{
private int numQuestions; // Number of questions
private double pointsEach; // Points for each question
private int numMissed; // Number of questions missed
/** * The constructor accepts as arguments the number
* of questions on the exam and the number of
* questions the student missed.
*/
public FinalExam(int questions, int missed)
{
double numericScore; // To calculate the 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 superclass's setScore method to
// set the numeric score.
setScore(numericScore);
}
/** * The getPointsEach method returns the pointsEach
* field.
*/
public double getPointsEach()
{
return pointsEach;
}
/**
* The getNumMissed method returns the numMissed
* field.*/
public int getNumMissed()
{
return numMissed;
}
}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Methods of StringBuilder class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education