THIS QUESTION IS RELATED TO SUBJECT OBJECT ORIENTED PROGRAMMING IN C++ . SOLVE this question in dev c++ . Do not change the names of functions and variables.Do not define extra functions except for required constructors. please send it in 30 minutes. THANKS Q#2 Write a class named Grade that has the following member variables and functions. Variables : protected: double score, char letter Functions: Required Constructors Getscore() // it will return score Getgrade() // it will assign the grades to letter variable and returns it. If score> 89 then A, > 79 then B, ..>69 then C, > 59 then D, else F. Derive a class named PassFail publically from class Grade that has the following member variables and functions. Variables: private: MinPassing Functions: Required constructors Getgrade() // it will return “P” if score >=MinPassing else return “F” Derive a class named FinalExam publically from class PassFail that has the following member variables and functions. Variables : private :questions (total questions), missed(missed questions), points (points of each question) Functions: Required constructors CalculateScore() // it will calculate points of each question if total marks are 80. It will also calculate the final score and assign it to the score variable in Grade class. 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 PassFail exam that is also observed by the teacher and assigned a numeric score. The minimum passing score is 70. • A FinalExam that has 50 questions. Write a class named CourseGrades . The class should have a member named grades that is an array of Grade pointers. The grades array should have 3 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 Grade 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. setPassFail : This function should accept the address of a PassFail object as its argument. This object should already hold the student’s score for the PassFail exam. Element 1 of the grades array should reference this object. setFinalExam : 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. print : This function should display the numeric scores and grades for each element in the grades array. Make sure that for PassFail object, P or F is displayed and for FinalExam object, grade (A – F) is displayed. Write a main function that will declare and initialize pointer objects of type Grade, PassFail and FinalExam using constructor. Then declare object of coursegrades class and call the setLab, setPassFail setFinalExam and print function.
THIS QUESTION IS RELATED TO SUBJECT OBJECT ORIENTED PROGRAMMING IN C++ . SOLVE this question in dev c++ . Do not change the names of functions and variables.Do not define extra functions except for required constructors. please send it in 30 minutes. THANKS
Q#2
Write a class named Grade that has the following member variables and functions.
Variables : protected: double score, char letter
Functions: Required Constructors
Getscore() // it will return score
Getgrade() // it will assign the grades to letter variable and returns it. If score> 89 then A, > 79 then B, ..>69 then C, > 59 then D, else F.
Derive a class named PassFail publically from class Grade that has the following member variables and functions.
Variables: private: MinPassing
Functions: Required constructors
Getgrade() // it will return “P” if score >=MinPassing else return “F”
Derive a class named FinalExam publically from class PassFail that has the following member variables and functions.
Variables : private :questions (total questions), missed(missed questions), points (points of each question)
Functions: Required constructors
CalculateScore() // it will calculate points of each question if total marks are 80. It will also calculate the final score and assign it to the score variable in Grade class.
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 PassFail exam that is also observed by the teacher and assigned a numeric score. The minimum passing score is 70.
• A FinalExam that has 50 questions.
Write a class named CourseGrades . The class should have a member named grades that is an array of Grade pointers. The grades array should have 3 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 Grade 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.
setPassFail : This function should accept the address of a PassFail object as its argument. This object should already hold the student’s score for the PassFail exam. Element 1 of the grades array should reference this object.
setFinalExam : 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.
print : This function should display the numeric scores and grades for each element in the grades array. Make sure that for PassFail object, P or F is displayed and for FinalExam object, grade (A – F) is displayed.
Write a main function that will declare and initialize pointer objects of type Grade, PassFail and FinalExam using constructor. Then declare object of coursegrades class and call the setLab, setPassFail setFinalExam and print function.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images