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

Write a program to compute the total score and assign letter grades to students

ID: 3566463 • Letter: W

Question

Write a program to compute the total score and assign letter grades to students for a course.The total score is a weighted sum of grades from five quizzes, five homeworks, and three exams. The break-up of the grades is as follows:

-Quizzes (10%) : Each of the 5 quizzes will comprise 2% of the total score

-Homeworks (30%) : Each of the 3 homeworks will comprise 10% of the total score

-Exams (60%) : Each of the 3 exams will comprise 20% of the total score

-Scores for each student are presented on a single row in the input file as follows:

Student ID Q1 Q2 Q3 Q4 Q5 HW1 HW2 HW3 E1 E2 E3

For example for input line 2 above, 11968 71 49 85 87 53 99 82 47 70 69 54

Student ID = 11968

Q1 score = 71

Q2 score = 49

Q3 score = 85

Q4 score = 87

Q5 score = 53

HW1 score = 99

HW2 score = 82

HW3 score = 47

E1 score = 70

E2 score = 69

E3 score = 54

Weighted Scores can then be determined as follows

Quiz score = 71*0.02 + 49*0.02 + 85*0.02 + 87*0.02 + 53*0.02 = 6.9

HW score = 99*0.1 + 82*0.1 + 47*0.1 = 22.8

Exam score = 70*0.2 + 69*0.2 + 54*0.2 = 38.6

Total = 6.9+22.8+38.6 = 68.3

Once you have the weighted total computed, assign a letter grade using the following grade

scale: 90%

Explanation / Answer

#include<iostream>
#include<fstream>

using namespace std;

int main(){
ifstream infile;
infile.open("input.txt");
ofstream outfile;
outfile.open("output.txt");
int id;
double sum;
int score;
outfile << "Student Test Quiz Final Course Final ";
outfile << " ID Average Average Exam Average Grade ";
outfile << "------- --------- ------- ------ -------- -------- ";
cout << "Student Quiz Test Final Course Final ";
cout << " ID Average Average Exam Average Grade ";
cout << "------- --------- ------- ------ -------- -------- ";
while(!infile.eof()){
sum = 0;
int temp = 0;
infile >> id;
outfile <<" " << id ;
cout <<" " << id ;
for(int i= 0; i< 5; i++){
infile >> score;
temp += 0.02*(double)score;
}
outfile << " " << (double)temp/5;
cout << " " << (double)temp/5;
sum += temp;
temp = 0;
for(int i=0; i< 3; i++){
infile >> score;
temp += 0.1*(double)score;
}
outfile << " " << (double)temp/3;
cout << " " << (double)temp/3;
sum += temp;
temp = 0;
for(int i=0; i< 3; i++){
infile >> score;
temp += 0.2*(double)score;
}
outfile << " " << (double)temp/3;
cout << " " << (double)temp/3;
sum += temp;
temp = 0;
outfile << " " << sum;
cout << " " << sum;

temp = (int)sum/10;
switch(temp){
case 9:
cout <<" A ";
outfile <<" A ";
break;
case 8:
cout <<" B ";
outfile <<" B ";
break;
case 7:
cout <<" C ";
outfile <<" C ";
break;
case 6:
cout <<" D ";
outfile <<" D ";
break;
default :
cout <<" F ";
outfile <<" F ";
}
}
}

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