Question: Essay Class Design an Essay class that extends the GradedActivity(Shown below) class presented in this chapter. The Essay class should determine the grade a student

Essay Class Design an Essay class that extends the GradedActivity(Shown below) class presented in this chapter. The Essay class should determine the grade a student receives for an essay. The students essay score can be up to 100 and is determined in the following manner: Grammar: 30 points Spelling: 20 points Correct length: 20 points Content: 30 points Demonstrate the class in a simple program.

//GradedActivity Class

/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package essaydemo;

/** A class that holds a grade for a graded activity. */

public class GradedActivity { private double score; // Numeric score

/** The setScore method sets the score field. @param s The value to store in score. */

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

/** The getScore method returns the score. @return The value stored in the score field. */

public double getScore() { return score; }

/** The getGrade method returns a letter grade determined from the score field. @return The letter grade. */

public char getGrade() { char letterGrade;

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; } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!