Question: Complete the code (provided the output) Term paper: Grammar points: 25.0 Spelling points: 18.0 Length points: 20.0 Content points: 25.0 Total points: 88.0 Grade: B

Complete the code (provided the output)

Complete the code (provided the output) Term paper: Grammar points: 25.0 Spellingpoints: 18.0 Length points: 20.0 Content points: 25.0 Total points: 88.0 Grade:B /** * Chapter 9 * Programming Challenge 4: Essay Class *

Term paper: Grammar points: 25.0 Spelling points: 18.0 Length points: 20.0 Content points: 25.0 Total points: 88.0 Grade: B /** * Chapter 9 * Programming Challenge 4: Essay Class * This program demonstrates the Essay class. */ public class EssayDemo { public static void main(String[] args) { // Create an Essay object. Essay termPaper = new Essay(); // Assign scores to the object. // Grammar = 25 points, Spelling = 18 points, // Length = 20 points, and content 25 points. termPaper.setScore (25.0, 18.0, 20.0, 25.0); = // Display the score details. System.out.println("Term paper:"); System.out.println("Grammar points: " + termPaper.getGrammar()); System.out.println("Spelling points: " termPaper.getSpelling() ); System.out.println("Length points: " + termPaper.getCorrectLength()); System.out.println("Content points: " + termPaper.getContent()); System.out.println("Total points: " + termPaper.getScore()); System.out.println("Grade: termPaper.getGrade()); 11 } } /** * Chapter 9 * Programming Challenge 4: Essay Class * The GradedActivity class holds a grade * for a graded activity */ public class GradedActivity { private double score; 11 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; }

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!