Question: In C++, Design an Essay class that is derived from the GradedActivity class presented in this chapter. The Essay class should determine the grade a

In C++, Design an Essay class that is derived from the GradedActivity class presented in this chapter. 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. Below is the GradedActivity. Use both of them in C++.

 #ifndef GRADEDACTIVITY_H #define GRADEDACTIVITY_H // GradedActivity class declaration class GradedActivity { protected: double score; // To hold the numeric score public: // Default constructor GradedActivity() { score = 0.0; } // Constructor GradedActivity(double s) { score = s; } // Mutator function void setScore(double s) { score = s; } // Accessor functions virtual double getScore() const { return score; } virtual char getLetterGrade() const; }; #endif 

 #include "GradedActivity.h" //****************************************************** // Member function GradedActivity::getLetterGrade * //****************************************************** char GradedActivity::getLetterGrade() const { char letterGrade; // To hold the letter grade if (score > 89) letterGrade = 'A'; else if (score > 79) letterGrade = 'B'; else if (score > 69) letterGrade = 'C'; else if (score > 59) letterGrade = 'D'; else letterGrade = 'F'; return letterGrade; } 

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!