Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Design an Essay class that extends the GradedActivity class presented in this ch

ID: 3655565 • Letter: D

Question

Design an Essay class that extends the GradedActivity class presented in this chapter. The Essay class should determine the grade a student receives for an essay. The student's essay score can be up to 100 and is determined in the following manner: Grammar: up to 30 points Spelling: up to 20 points Correct Length: up to 20 points Content: up to 30 points Once you have designed the class , design a program that prompts the user to enter the number of points that a student has earned for grammer, spelling, length and content. Create an Essay object and store this data in the object. Use the objects methods to get the students over all score and grade , and display this data on the screen.

Explanation / Answer

import java.util.Scanner; public class Essay extends GradedActivity { int grammerPoints; int spellingPoints; int lengthPoints; int contentPoints; int totalPoints; char grade; public static void main(String[] args) { Essay essay = new Essay(); Scanner input = new Scanner(System.in); System.out.println("Enter the grammer points upto 30 points :"); essay.grammerPoints = input.nextInt(); System.out.println("Enter the spelling points upto 20 points :"); essay.spellingPoints = input.nextInt(); System.out.println("Enter the length points upto 20 points :"); essay.lengthPoints = input.nextInt(); System.out.println("Enter the content points upto 30 points :"); essay.contentPoints = input.nextInt(); essay.totalPoints = essay.grammerPoints + essay.spellingPoints + essay.lengthPoints + essay.contentPoints; if (essay.totalPoints >= 60) essay.grade = 'A'; else if (essay.totalPoints >= 45 && essay.totalPoints < 60) essay.grade = 'B'; else essay.grade = 'C'; System.out.println("Total Points is " + essay.totalPoints + " and grade is " + essay.grade); } }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote