Project7 CECS277 solution

$25.00

Category:

Description

5/5 - (4 votes)

Part 1:Essay Class
Design an Essay class that inherits from the GradedActivity class. The Essay class should
determine the grade a student receives on an essay. The student’s 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.
Assign scores to the object.
Grammer = 25 points, Spelling = 18 points,
Length = 20 points, and Content = 25 points.
Essay termPaper = new Essay();
termPaper.setScore(25.0, 18.0, 20.0, 25.0);
Sample output:
Part 2 : Course Grades
In a course, a teacher gives the following tests and assignments:
 A lab activity that is observed by the teacher and assigned a numeric score.
 A pass/fail exam that has 10 questions. The minimum passing score is 70.
 An essay that is assigned a numeric score.
 A final exam that has 50 questions.
Write a class named CourseGrades. The class should have an array
of GradedActivity objects as a field. The array should be named grades.
The grades array should have four elements, one for each of the assignments previously
described. The class should have the following methods:
Demonstrate the class in a program.
Following classes extends from GradedActivity…
Essay class: please see the class description in step one.
Private Member Fields:
numQuestions: int
pointsEach: double
numMissed: int
Public methods:
Overloaded constructor: void
accepts as arguments the number of questions on the exam and the number of questions the student
missed.
getPointsEach(): double
getNumMissed(): int
FinalExam class:
Private Member Fields:
minPassingScore: double // Minimum passing score
Public methods:
Overloaded constructor
Accept the minimum passing score as its argument

getGrade: char
The getGrade method returns a letter grade determined from the score field. This method overrides the
superclass method.

Private Member Fields:
numQuestions: int
pointsEach: double
numMissed: int
Public methods:
Overloaded constructor: void
accepts as arguments the number of questions on the exam and the number of questions the student
missed.
getPointsEach(): double
getNumMissed(): int
PassFailExam class extends from PassFailActivity
PassFailActivity class:
Sample output for these specific inputs:
Create an object for the lab grade and set the lab score to 85.
Create an object for the pass/fail exam.
20 total questions, 3 questions missed, minimum passing score is 70.
Create an object for the essay grade and Set the essay scores.
Grammer = 25, spelling = 18, length = 17, content = 20.
Create an object for the final exam. 50 questions, 10 missed.
Part 3: Analyzable Interface
Modify the CourseGrades class you created in part2 so that it implements the following interface:
The getAverage method should return the average of the numeric scores stored in the grades array.
The getHighest method should return a reference to the element of the grades array that has the highest
numeric score. The getLowest method should return a reference to the element of the grades array that has
the lowest numeric score. Demonstrate the new methods in a complete program.
In UML, the empty diamond
signifies an aggregation.
Aggregation is a variant of the
“has a” association relationship
This relation is stronger than a
simple association. In this case a
CourseGrades aggregates
GradedActivity.