In a course a teacher gives the following tests and


Programming Project: 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 that implements the following interface:

public interface Analyzable

{

double getAverage();

GradedActivity getHighest();

GradedActivity getLowest();

}

The class should have a GradedActivity array named grades as a field. The array should have four elements, one for each of the assignments previously described. The class should have the following methods:

setLab: This method should accept a GradedActivity object as its argument. This object should already hold the student's score for the lab activity. Element 0 of the grades field should reference this object.

setPassFailExam: This method should accept a PassFailExam object as its argument. This object should already hold the student's score for the pass/fail exam. Element 1 of the grades field should reference this object.

setEssay: This method should accept an Essay object as its argument. The Essay class 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: 1) Grammar: 30 points, 2) Spelling: 20 points, 3) Correct length: 20 points, and Content: 30 points. Element 2 of the grades field should reference this object.

setFanalExam: This method should accept a FinalExam object as tis argument. This object should already hold the student's score for the final exam. Element 3 of the grades field should reference this object.

toString: This method should return a string that contains the numeric scores and grades for each element in the grades array.

Demonstrate the class with a driver program.

Solution Preview :

Prepared by a verified Expert
JAVA Programming: In a course a teacher gives the following tests and
Reference No:- TGS02902679

Now Priced at $15 (50% Discount)

Recommended (97%)

Rated (4.9/5)