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. Record all results to a data fi

ID: 1812460 • Letter: W

Question

Write a program to complete the following tasks. Record all results to a data file called "GradeSheet.dat".

(1) Read the grade sheet from attached data file, "Assignment4.dat". Print the original grade sheet.

(3) Write a module to sort array GRADE[] and print the sorted grade sheet.

(4) Write a module to sort array NAME[] and print the sorted grade sheet.

(5) Write a module to sort array ID[] and print the sorted grade sheet.

(6) Write a module to print the student's id, name, and grade for student with highest grade and with lowest grade, respectively.

(7) Write a module to determine mean of the grades.

(8) Write a module to list students with grade is less than mean.

Explanation / Answer

#include<iostream> #include<iomanip> #include<fstream> #include<string> #include<cstdlib> #include<ctime>
using namespace std; const int size=10; int ID[size]={5532,7856,3345,1229,2788,9954,2388,6523,1287,2783}; string NAME[size]={"Mary","Tom","Cathy","Jim","David","Rob","Sue","Mohamed","Zach","Amy"},line; double GRADE[size]={100.00,98.89,64.33,87.89,55.34,89.98,77.45,90.00,87.64,50.00}; double mean( double GRADE[], int size); ifstream fin; ofstream fout; double rand_grade( double a, double b); void printsheet( int ID[], string NAME[], double GRADE[], int size); void read_array(int ID[], string NAME[], double GRADE[], int size);
int main() { int i=0; ofstream outfile; ifstream infile; infile.open("GradeSheet.dat"); outfile.open("Gradesheet.dat"); outfile<<setw(15)<<"ID"<<setw(15)<<"NAME"<<setw(15)<<"GRADE"<<endl; outfile.close();
cout<<setw(15)<<"ID"<<setw(15)<<"NAME"<<setw(15)<<"GRADE"<<endl<<endl;
read_array(ID, NAME, GRADE, size);    printsheet(ID, NAME, GRADE, size); system("pause"); }


void read_array(int ID[], string NAME[], double GRADE[], int size) { for(int i=0; i<=size; i++) {    } }



double mean( double GRADE[], int size) {
double sum=0;
for( int i=0; i<size; i++) { sum+=GRADE[i]; }
return sum/size; }

void printsheet( int ID[], string NAME[], double GRADE[], int size) { cout<<line<<endl; for( int i=0; i<size; i++) { cout<<setw(15)<<ID[i]<<setw(15)<<NAME[i]<<setw(15)<<GRADE[i]<<endl<<endl;

}
}
double rand_grade( double a, double b) { return ((double)rand()/RAND_MAX)*(b-a)+a; }

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