Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Redo your definition of the class CDAccount from your currentprogramming project

ID: 3644930 • Letter: R

Question


Redo your definition of the class CDAccount from your currentprogramming project so that it has the same interface but adifferent implementation. The new implementation for the classCDAccount will record the balance as two values of type int:one for dollars and one for cents. The member variable for theinterest rate will store the interest rate as a fraction ratherthan as a percentage. For example, an interest rate of 5.9 % willbe stored as the value of 0.059 of type double.

#include <iostream>
using namespace std;
const int CLASS_SIZE = 5;
class StudentRecord
{
private: int studentNumber;
double quiz1;
double quiz2;
double midterm;
double final;
double average;
char grade;
public:
void input(StudentRecord& student);
void computeGrade(StudentRecord& student);
void output(const StudentRecord student);
};
int main()
{
StudentRecord student[CLASS_SIZE];
for(int i = 0; i < CLASS_SIZE; i++)
student[i].input(student[i]);
for(int i = 0; i < CLASS_SIZE; i++)
{
student[i].computeGrade(student[i]);
student[i].output(student[i]);
cout << endl;
}
system("pause");
}
void StudentRecord:: input(StudentRecord &student)
{
cout << "Enter student number: ";
cin >> student.studentNumber;
cout << " Enter two 10 point quizes" << endl;
cin >> student.quiz1 >> student.quiz2;
cout << " Enter the midterm and final exam grades." << "These are 100 point tests ";
cin >> student.midterm >> student.final;
}
void StudentRecord:: computeGrade(StudentRecord& student)
{
double quizAvg= (student.quiz1 + student.quiz2)/2.0;
double quizAvgNormalized = quizAvg * 10;
student.average = student.final * 0.5 +
student.midterm * 0.25 +quizAvgNormalized * 0.25;
char letterGrade[]= "FFFFFFDCBAA";
int index = static_cast<int>(student.average/10);
if(index < 0 || 10 <= index)
{
cout << "Bad numeric grade: "
<< student.average << endl
<< " Aborting. ";
abort();
}
student.grade = letterGrade[index];
}
void StudentRecord:: output(const StudentRecord student)
{
cout << "The record for student number: " << student.studentNumber << endl;
cout<< "The quiz of grades are: " << student.quiz1 << " " << student.quiz2 << endl;
cout<< "The midterm and exam grades are: " << student.midterm << " " << student.final << endl;
cout<< "The numeric average is: " << student.average << endl;
cout<< "Grade assigned is "<< student.grade<< endl;
}

Explanation / Answer

Enter student number: 23 Enter two 10 point quizes 2 7 Enter the midterm and final exam grades.These are 100 point tests 57 87 Enter student number: 101 Enter two 10 point quizes 3 6 Enter the midterm and final exam grades.These are 100 point tests 98 78 Enter student number: 2 Enter two 10 point quizes 1 3 Enter the midterm and final exam grades.These are 100 point tests 34 44 Enter student number: 10 Enter two 10 point quizes 2 4 Enter the midterm and final exam grades.These are 100 point tests 24 54 Enter student number: 2 Enter two 10 point quizes 43 1 Enter the midterm and final exam grades.These are 100 point tests 3 4 The record for student number: 23 The quiz of grades are: 2 7 The midterm and exam grades are: 57 87 The numeric average is: 69 Grade assigned is D The record for student number: 101 The quiz of grades are: 3 6 The midterm and exam grades are: 98 78 The numeric average is: 74.75 Grade assigned is C The record for student number: 2 The quiz of grades are: 1 3 The midterm and exam grades are: 34 44 The numeric average is: 35.5 Grade assigned is F The record for student number: 10 The quiz of grades are: 2 4 The midterm and exam grades are: 24 54 The numeric average is: 40.5 Grade assigned is F The record for student number: 2 The quiz of grades are: 43 1 The midterm and exam grades are: 3 4 The numeric average is: 57.75 Grade assigned is F Press any key to continue . . .

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote