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

Write a program to complete the following tasks and record the outputs to a data

ID: 3343791 • Letter: W

Question

Write a program to complete the following tasks and record the outputs to a data file named %u201CEGR126-Final.dat%u201D. Headings (CourseNumber, Credit Hours and LetterGrade / NumericalGrade ) should be included in the outputs.



(1) Read John%u2019s transcript from %u201CGPA.dat%u201D and print the content to screen.



(2) Write a module to generate random numerical grades for each course. Print the updated transcript (with numerical grades) to the data file srand() must be applied in the program.




%u2018A%u2019 : 100?grade?90


%u2018B%u2019 : 89.99>grade?80


%u2018C%u2019 : 79.99>grade?70


%u2018D%u2019 : 69.99>grade?60


%u2018F%u2019 : 0?grade<59.99 p="">







(3) Determine John%u2019s GPA (GPA is calculated by dividing the total amount of grade points earned by the total amount of credit hours attempted).



Grades Points


%u2018A%u2019 4


%u2018B%u2019 3


%u2018C%u2019 2


%u2018D%u2019 1


%u2018F%u2019 0


Explanation / Answer

#include<iostream>
#include<fstream>
#include<iomanip>
#include<string>
#include<ctime>

using namespace std;

double rand_doub(int a, int b);

int main()
{
const int size=10;

string coursenumber[size]; //array
int credithours[size], count=0;
char lettergrade[size];
double numgrade[size];

string line;


srand(unsigned (time(NULL))); // need to include ctime

ifstream fin;
ofstream fout;


fin.open("GPA.dat");
getline(fin, line);
cout<<line<<endl;

fin>>coursenumber[count]>>credithours[co%u2026
while (!fin.eof())//build the array
{
count++;
for(int i=0;i<count; i++)
{

numgrade[i] = rand_doub(0,100);

cout<<setw(10)<<coursenumber[count]<<set%u2026

}


fin>>coursenumber[count]>>credithours[co%u2026

}


//assign numerical grade and print (fout) the whole list to a datafile



// determine GPA





fin.close();

fout.close();

system("pause");
}


double rand_doub(int a, int b)
{
return(((double)rand()/RAND_MAX)*(b-a)+a%u2026
}

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