Question: IN JAVA I have to complete the code This is the given code ======================================================================================================== /** * Chapter 9 * Programming Challenge 4: Essay Class *

IN JAVA I have to complete the code

This is the given code

========================================================================================================

/** * 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()); } }

========================================================================================================

/** * Chapter 9 * Programming Challenge 4: Essay Class * The GradedActivity class 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; } }

========================================================================================================

This is what the output should look like IN JAVA I have to complete the code This is the given

Term paper: Grammar points: 25.0 Spelling points: 18.0 Length points: 20.0 Content points: 25.0 Total points: 88.0 Grade: B

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!