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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started