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

Module 10 Programming Problem Instructions Please submit the the answer file(s)

ID: 3598647 • Letter: M

Question

Module 10 Programming Problem Instructions Please submit the the answer file(s) with your response to Programming Exercise #5 on page 566 to this assignment link.

The class and pseudocode may be submitted as Word files.

5. Essay Class 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: l Grammar: up to 30 points l Spelling: up to 20 points l Correct length: up to 20 points l 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 grammar, spelling, length, and content. Create an Essay object and store this data in the object. Use the object’s methods to get the student’s overall score and grade, and display this data on the screen. there is nothing missing here this is the question from the book pg 566 Exercise 5

Explanation / Answer

CODE

import java.util.Scanner;

public class GradedActivity
{
private double score;

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

public double getScore()
{
return score;
}
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;
}
}
public class Essay extends GradedActivity
{
private double grammar;
private double spelling;
private double correctLength;
private double content;

public void setScore(double gr, double sp, double len, double cnt)
{
setGrammar(gr);
setSpelling(sp);
setCorrectLength(len);
setContent(cnt);
super.setScore(grammar + spelling + correctLength + content);
}

private void setGrammar(double g)
{
if (g <= 30.0)
grammar = g;
else
grammar = 0.0;
}
private void setSpelling(double s)
{
if (s <= 20.0)
spelling = s;
else
spelling = 0.0;
}

private void setCorrectLength(double c)
{
if (c <= 20.0)
correctLength = c;
else
correctLength = 0.0;
}
private void setContent(double c)
{
if (c <= 30)
content = c;
else
content = 0.0;
}
public double getGrammar()
{
return grammar;
}
public double getSpelling()
{
return spelling;
}
public double getCorrectLength()
{
return correctLength;
}

public double getContent()
{
return content;
}
public double getScore()
{
return grammar + spelling + correctLength + content;
}
}

public class FinalExam extends GradedActivity

{
private int numQuestions;
private double pointsEach;
private int numMissed;

public FinalExam(int questions, int missed)
{
double numericScore;

numQuestions = questions;
numMissed = missed;

pointsEach = 100.0 / questions;
numericScore = 100.0 - (missed * pointsEach);

setScore(numericScore);
}

public double getPointsEach()
{
return pointsEach;
}

public int getNumMissed()
{
return numMissed;
}
}

public class PassFailActivity extends GradedActivity
{
private double minPassingScore;

public PassFailActivity(double mps)
{
minPassingScore = mps;
}

public char getGrade()
{
char letterGrade;

if (super.getScore() >= minPassingScore)
letterGrade = 'P';
else
letterGrade = 'F';

return letterGrade;
}
}
public class PassFailExam extends PassFailActivity
{
private int numQuestions;
private double pointsEach;
private int numMissed;


public PassFailExam(int questions, int missed, double minPassing)
{
super(minPassing);
double numericScore;
numQuestions = questions;
numMissed = missed;
pointsEach = 100.0 / questions;
numericScore = 100.0 - (missed * pointsEach);
setScore(numericScore);
}
public double getPointsEach()
{
return pointsEach;
}
public int getNumMissed()
{
return numMissed;
}
}

IF ANY QUERIES REGARDING CODE PLEASE GET BACK TO ME
THANK YOU

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