33. Some schools have a grade-replacement policy: A student can retake a course,
ID: 3870039 • Letter: 3
Question
33. Some schools have a grade-replacement policy: A student can retake a course, remove the old grade, and post the new grade in the record. Using the implementation of the gradeRecord class from Programming Exercise 1-32, create a new header file "xgrade.h" that adds the member function replaceGrade) to the gradeRecord class. void replaceGrade(int oldUnits, int oldGradePts int newUnits, int newGradePts); The function updates the grade record by first deleting the old units and grade points and then adding the new grade information. Write a program that declares the grade Record object dHarris. After initially displaying the GPA, indicate the effect of replacing four units of D (one gradept per unit) with anAExplanation / Answer
Please find the code belo :
void gradeRecord::replaceGrade(int oldUnits, int oldGradePts, int newUnits, int newGradePts)
{
units = units - oldUnits + newUnits;
gradepts = gradepts - oldGradePts + newGradePts;
}
int main()
{
gradeRecord dHarris("558-25-4424",100,180);
cout<<"GPA : "<<dHarris.gpa();
dHarris.replaceGrade(4,4,4,16);
cout<<"Revised GPA : "<<dHarris.gpa();
return 0;
}
Please merge above code to your existing code to get output.
Please provide more details of gradeRecord class so that a complete code could be provided.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.