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

Construct a C++ grading program for a class with the following grading policies:

ID: 3877843 • Letter: C

Question

Construct a C++ grading program for a class with the following grading policies:-

a. There are two quizzes, each quizzes is worth 10 points.

b. There is one mid semester test and one final test, each is worth 100 points.

c. The final test accounts for 50 percent of the grade, the mid semester test accounts for 25 percent of the grade and the two quizzes together count for another total 25 percent.

Grading system is as follows:-

>90                                        A

>=80 and <90                        B

>=70 and <80                        C

>=60 and <70                        D

<60                                        E

The program should read in the student's scores and output the student's record, which consists of two quiz and two exam scores as well as the student's average numeric score for the entire course and the final letter grade. Define and use a structure for the student record.

Use these functions to create the program.

void ENTER(S& st); // Asks the user to input for one student and sets the structure variable members.//

void A(S& st); //use this to determine the numeric average and letter grade.//

void R(const S st); //outputs the student record.

Sample Output:-

Sample data for the test run:-

1 7 10 90 95

2 9 8   90 80

3 7 8   70 80

4 5 8   50 70

5 4 0   40 35

Output:

input student #: 1

input the two quiz scores

7 10

Input midsemester test and final test scores

90 95

input student #: 2

input the two quiz scores

9 8

Input midsemester test and final test scores

90 80

input student #3

input the two quiz scores

7 8

Input midsemester test and final test scores

70 80

input student # 4

input the two quiz scores

5 8

Input midsemester test and final test scores

50 70

input student # 5

input the two quiz scores

4 0

Input midsemester test and final test scores

40 35

Record for student # : 1

Quiz scores : 7 10

Midsemester test and final test scores: 90 95

Average: 91.25

Letter grade earned is A

Record for student #: 2

Quiz Scores: 9 8

Midsemester test and final test scores: 90 80

Average: 83.75

Letter grade earned is B

Record for student #: 3

Quiz Scores: 7 8

Midsemester test and final test scores: 70 80

Average: 76.25

Letter Grade earned is C

Record for student: 4

Quiz Scores: 5 8

Midsemester test and final test scores: 50 70

Average: 63.75

Letter Grade earned is D

Record for student #: 5

Quiz Scores: 4 0

Midsemester and final test scores: 40 35

Average: 32.5

Letter Grade is earned is F

Explanation / Answer

//a program to calculate the student's average test score and grade

#include <iostream>
#include <iomanip>

using namespace std;

struct S{
float quizz1;
float quizz2;
float finaltest;
float midtest;
float avg;
char grade;
};
void ENTER(S& st); // Asks the user to input for one student and sets the structure variable members.//

void A(S& st); //use this to determine the numeric average and letter grade.//

void R(const S st); //outputs the student record.

int main() {
  
int numberofstudent;
  
int i;
// prompt the input the number of student
cout<<" Enter the number of students :";
cin>>numberofstudent;
  
S st[numberofstudent];
//performs the loop until number of student
for(i = 0; i<numberofstudent; i++){
cout<< " Input Student #"<<i+1<<endl;
ENTER(st[i]);  
A(st[i]);
}
//displays each student record
for(i = 0; i<numberofstudent; i++){
cout<< " Student #"<<i+1<<endl;
R(st[i]);  
}
  
return 0;
}

void ENTER(S& st){
//prompt the input from the user
cout<<" Input the two quiz scores :";
cin>>st.quizz1>>st.quizz2;
cout<<" Input midsemester test and final test scores :";
cin>>st.midtest>>st.finaltest;
  
}

//display the students record
void R(S st){
  
cout<<" The two quiz scores :";
cout<<st.quizz1<<" "<<st.quizz2;
cout<<" The midsemester test and final test scores :";
cout<<st.midtest<<" "<<st.finaltest;
cout<<" Average :"<<st.avg;
cout<<" Letter Grade earned is :"<<st.grade;
}

//method that calculates the average and grade for each student
void A(S& st){

st.avg = ((st.quizz1+st.quizz2)*5/4)+(st.midtest/4)+(st.finaltest/2);
if (st.avg >90 )
st.grade = 'A';
else if((st.avg >=80)&&(st.avg<90))
st.grade ='B';
else if((st.avg >=70)&&(st.avg<80))
st.grade ='C' ;
else if((st.avg >=60)&&(st.avg<70))
st.grade ='B' ;
else if(st.avg <60)
st.grade ='E' ;
}

OUTPUT:


Enter the number of students :3

Input Student #1

Input the two quiz scores :7 10

Input midsemester test and final test scores :90 95

Input Student #2

Input the two quiz scores :9 8

Input midsemester test and final test scores :90 80

Input Student #3

Input the two quiz scores :7 8

Input midsemester test and final test scores :70 80

Student #1

The two quiz scores :7 10
The midsemester test and final test scores :90 95
Average :91.25
Letter Grade earned is :A
Student #2

The two quiz scores :9 8
The midsemester test and final test scores :90 80
Average :83.75
Letter Grade earned is :B
Student #3

The two quiz scores :7 8
The midsemester test and final test scores :70 80
Average :76.25
Letter Grade earned is :C
RUN SUCCESSFUL (total time: 49s)