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

This new version of the program needs to read an input file that contains twenty

ID: 3538683 • Letter: T

Question

This new version of the program needs to read an input file that contains twenty students each with five test grades. Each students test scores must be averaged and assigned a letter grade. This information will be used to create a Computer Science Grade Report to an output file in a tabular form with title and headings. After the students, tests, test average and grade are listed then display each test average and overall test average. Then display the highest test grade and Student with highest test average.
text file Andrew Miller 87.5 89 65.75 37 98.5 John Doe 86 88 85.25 90 95 John Smith 52 82 79 88.5 85 Jane Deer 90 93 91 92.75 94 William Clinton 95 97 95.75 90 92 George Jones 89 81.5 75 85.25 88 Sarah White 75.5 78 85 88 84 Bill Able 88 90 86.75 91 93.5 Larry Brown 99 95 98 96.5 97 Amanda Ernst 76 79.5 77 82 84.25 Richard Farmer 84.75 87 80 85 86 Sam Green 87 91.75 85 88 90 Paula Hamilton 98 100 97.5 95 98.5 Jesus Javiar 77.5 82 85 78 86 Christy King 86 89.25 92 90 94.75 Bob Bush 70 75.5 77 79 81.25 Jerry Landers 95.5 97 96 92.75 94 Sally Moore 97 99 98.25 94 99 Nancy Nadler 91 93.25 90 89 92.5 Tina Templar 85 82 88.75 84 90
help me to modify thisprogram #include <iostream> #include <fstream> #include <iomanip> #include <string>
using namespace std;
int main() { //Declare variables; ifstream inFile; //input file stream variable ofstream outFile; //output file stream variable
double testScore; double sum = 0; string firstName;    string lastName;
inFile.open("test.txt"); outFile.open("testavg.out");   
outFile << fixed << showpoint; outFile << setprecision(2);   
cout << "Processing data" << endl;
inFile >> firstName >> lastName; outFile << "Student name: " << firstName << " " << lastName << endl; outFile << "Test scores: ";
inFile >> testScore; //Read the first test score outFile << setw(6) << testScore; //Output the test score sum = sum + testScore; //Update sum
inFile >> testScore; //Read the second test score outFile << setw(6) << testScore; //Output the test score sum = sum + testScore; //Update sum
inFile >> testScore; //Read the third test score outFile << setw(6) << testScore; //Output the test score sum = sum + testScore; //Update sum
inFile >> testScore; //Read the fourth test score outFile << setw(6) << testScore; //Output the test score sum = sum + testScore; //Update sum
inFile >> testScore; //Read the fifth test score outFile << setw(6) << testScore; //Output the test score sum = sum + testScore; //Update sum
outFile << endl;
outFile << "Average test score: " << setw(6) << sum / 5.0 << endl;
inFile.close(); outFile.close();

char holdscr; // This character and section is to hold screen open
cout << " Press a character and Enter to exit program. ";
cin >> holdscr;
return 0; }
This new version of the program needs to read an input file that contains twenty students each with five test grades. Each students test scores must be averaged and assigned a letter grade. This information will be used to create a Computer Science Grade Report to an output file in a tabular form with title and headings. After the students, tests, test average and grade are listed then display each test average and overall test average. Then display the highest test grade and Student with highest test average.
text file Andrew Miller 87.5 89 65.75 37 98.5 John Doe 86 88 85.25 90 95 John Smith 52 82 79 88.5 85 Jane Deer 90 93 91 92.75 94 William Clinton 95 97 95.75 90 92 George Jones 89 81.5 75 85.25 88 Sarah White 75.5 78 85 88 84 Bill Able 88 90 86.75 91 93.5 Larry Brown 99 95 98 96.5 97 Amanda Ernst 76 79.5 77 82 84.25 Richard Farmer 84.75 87 80 85 86 Sam Green 87 91.75 85 88 90 Paula Hamilton 98 100 97.5 95 98.5 Jesus Javiar 77.5 82 85 78 86 Christy King 86 89.25 92 90 94.75 Bob Bush 70 75.5 77 79 81.25 Jerry Landers 95.5 97 96 92.75 94 Sally Moore 97 99 98.25 94 99 Nancy Nadler 91 93.25 90 89 92.5 Tina Templar 85 82 88.75 84 90
help me to modify thisprogram #include <iostream> #include <fstream> #include <iomanip> #include <string>
using namespace std;
int main() { //Declare variables; ifstream inFile; //input file stream variable ofstream outFile; //output file stream variable
double testScore; double sum = 0; string firstName;    string lastName;
inFile.open("test.txt"); outFile.open("testavg.out");   
outFile << fixed << showpoint; outFile << setprecision(2);   
cout << "Processing data" << endl;
inFile >> firstName >> lastName; outFile << "Student name: " << firstName << " " << lastName << endl; outFile << "Test scores: ";
inFile >> testScore; //Read the first test score outFile << setw(6) << testScore; //Output the test score sum = sum + testScore; //Update sum
inFile >> testScore; //Read the second test score outFile << setw(6) << testScore; //Output the test score sum = sum + testScore; //Update sum
inFile >> testScore; //Read the third test score outFile << setw(6) << testScore; //Output the test score sum = sum + testScore; //Update sum
inFile >> testScore; //Read the fourth test score outFile << setw(6) << testScore; //Output the test score sum = sum + testScore; //Update sum
inFile >> testScore; //Read the fifth test score outFile << setw(6) << testScore; //Output the test score sum = sum + testScore; //Update sum
outFile << endl;
outFile << "Average test score: " << setw(6) << sum / 5.0 << endl;
inFile.close(); outFile.close();

char holdscr; // This character and section is to hold screen open
cout << " Press a character and Enter to exit program. ";
cin >> holdscr;
return 0; }

Explanation / Answer

#include <iostream>

#include <fstream>

#include <iomanip>

#include <string>


using namespace std;


int main()

{

//Declare variables;

double testScore;

double sum = 0;

string firstName;   

string lastName;

double scores[5] = {0};

int count = 0;

double highestGrade = 0;

string topperFirstName;

string topperLastName;

ifstream inFile; //input file stream variable

ofstream outFile; //output file stream variable



inFile.open("test.txt");

outFile.open("testavg.out");   


outFile << fixed << showpoint;

outFile << setprecision(2);   


cout << "Processing data" << endl;

while(!inFile.eof())

{

sum = 0;

inFile >> firstName >> lastName;

outFile << "Student name: " << firstName

<< " " << lastName << endl;

outFile << "Test scores: ";

for(int i=0;i<5;i++)

{

inFile >> testScore; //Read the first test score

outFile << setw(6) << testScore; //Output the test score

sum = sum + testScore; //Update sum

scores[i] = scores[i] + testScore;//Update sum of each test

}


outFile << endl;


double avg = sum / 5.0;

outFile << "Average test score: " << setw(6)

<< avg << endl << endl;

if(avg > highestGrade) //updating highest grade

{

highestGrade = avg;

topperFirstName = firstName;

topperLastName = lastName;

}

  

count++; //increase number of observations by 1

}   


sum = 0;

  

outFile << "Test averages: " ;

for(int i=0;i<5;i++)

{

outFile << setw(6) << scores[i]/count; //Output the test average

sum = sum + scores[i]/count;

}


outFile << endl;

  

outFile << "Overall test averages: " << setw(6)

<< sum/5.0 << endl ;


outFile << "Highest test grade: " << setw(6)

<< highestGrade << endl ;

outFile << "Student with highest grade: " << topperFirstName

<< " " << topperLastName << endl;

inFile.close();

outFile.close();



char holdscr; // This character and section is to hold screen open


cout << " Press a character and Enter to exit program. ";


cin >> holdscr;


return 0;

}

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