Step 1: The GradedActivity class The GradedActivity class is the base class. A d
ID: 3827577 • Letter: S
Question
Step 1: The GradedActivity class
The GradedActivity class is the base class.
A default constructor that initializes the score member variable to 0.0.
A constructor accepts an argument for score.
The setScore member function also accepts an argument for the score variable
The getLetterGrade member function returns the letter grade that corresponds to the value in score.
class GradedActivity
{
protected:
double score; // To hold the numeric score
public:
GradedActivity(); // Default constructor
GradedActivity(double s); // Constructor
void setScore(double s) ; // Mutator function
double getScore() const; // Accessor functions
virtual char getLetterGrade() const;
};
The following classes are derived class of GradeActivity. Each class should contain a default constructor and a constructor accepts argument(s) for score, a virtual function getLetterGrade that get the letter grades and a v.
Step 2: The Essay class
Design an Essay class that is derived 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
Step 3: The FinalExamm class
Design a Final class that is derived from the GradedActivity class. The FinalExam class has:
Member variable for the number of questions on the examm
The number of points each question is worth
The number of question missed by the student
Sample Output:
How many questions are on the final examm? 20
How many questions did the student miss? 2
Each question counts 5 points.
The examm grade is A.
Step 4: 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.
An essay that is assigned a numeric score.
A final examm that has 50 questions.
Write a class named CourseGrades. The class should have a member named grades that is an array of GradedActivity pointers. The grades array should have three elements, one for each of the assignments previously described. The class should have the following member functions:
setLab: This function should accept the address of a GradedActivity object as its argument. This object should already hold the student’s score for the lab activity. Element 0 of the grades array should reference this object.
setEssay: This function should accept the address of an Essay object as its argument. This object should already hold the student’s score for the essay. Element 1 of the grades array should reference this object.
seFinalExam: This function should accept the address of a FinalExam object as its argument. This object should already hold the student’s score for the final exam. Element 2 of the grades array should reference this object.
printGrade: This function should display the numeric scores and grades for each element in the grades array.
void pringGrade(const GradeActivity *score);
Demonstrate the class in a program.
Please answer it in C++ not java!!!!
Explanation / Answer
#include <fstream>
#include <iostream>
using namespace std;
int main()
{
int grade_num;
cout<< "Please enter numeric grade:"<< endl;
cin>> grade_num;
return 0;
}
char get_letter_grade (int grade_num)
{
if (grade_num<=60);
cout<< "The letter grade is F"<< endl;
else if ( grade_num<=69);
cout<< "The letter grade is D"<< endl;
else if (grade_num<=79);
cout<< "The letter grade is C"<< endl;
else if (grade_num<=89);
cout<< "The letter grade is B"<< endl;
else (grade_num<=100);
cout<< "The letter grade is A"<< endl;
return (grade_num);
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.