Question: In c++ Previous Program: #include #include #include using namespace std; //Function that prints student details void printResults(int sid[], double avg[], char grades[], int cnt) {

In c++

In c++ Previous Program: #include #include #include using namespace std; //Function thatprints student details void printResults(int sid[], double avg[], char grades[], int cnt)

Previous Program:

#include #include #include

using namespace std;

//Function that prints student details void printResults(int sid[], double avg[], char grades[], int cnt) { int i=0;

cout

//Printing header cout

//Iterating over each student for(i=0; i { //Printing data cout

//Helper function for countGrades int cntGrade(char grade, char grades[], int cnt) { int i, c=0;

//Iterating over grades for(i=0; i { //Comparing grade if(grade == grades[i]) { //incrementing count c += 1; } }

return c; }

//Counting count of each grade void countGrade(char grades[], int cnt) { int i; //Printing count of each grade

//Printing header cout

for(i=65; i

//Computing overall average of class double overallAvg(double avg[], int cnt) { int i; double sum=0, oAvg;

//Iterating over each average for(i=0; i { //Accumulating average sum += avg[i]; }

//Calculating overall average oAvg = sum / (double)(cnt);

return oAvg; }

//Main function int main() { //Opening file in read mode fstream fin("studentScores.dat");

//Parallel arrays int sid[100]; double avg[100]; char grade[100];

int t1, t2, t3, p1, p2, p3, p4, p5, p6, f; double tAvg, pAvg, totAvg;

//To hold number of students int stuCnt=0;

//Reading data from file while(fin.good()) { //Reading id fin >> sid[stuCnt];

//Reading test values and program values and final fin >> t1 >> t2 >> t3 >> p1 >> p2 >> p3 >> p4 >> p5 >> p6 >> f;

//Calculating averages tAvg = (t1+t2+t3) / 3.0; pAvg = (p1+p2+p3+p4+p5+p6) / 6.0;

//Calculating final average totAvg = (tAvg*0.50) + (pAvg * 0.25) + (f * 0.25);

//Storing in array avg[stuCnt] = totAvg;

//Finding grade if(totAvg > 89.5) { grade[stuCnt] = 'A'; } else if(totAvg > 79.5 && totAvg 69.5 && totAvg 59.5 && totAvg

//Incrementing student count stuCnt+=1; }

//Closing file fin.close();

//Writing results printResults(sid, avg, grade, stuCnt);

//Counting grades countGrade(grade, stuCnt);

//Printing overall average cout

return 0; }

CSC135 Program #7-Arrays2D (student averages) You are to modify the program that you wrote for Program #6 (Arrays) to make use of 2D (two dimensional) arrays. Refer to that assignment for details not specified here First, name your program: arrays.cpp you can copy it from the old program as follows cp arrays.cpp arrays2D.cpp In the previous program, you read student data from a file called studentScores.dat. You loaded the information into three parallel arrays, computing the average and letter grades for each student. You will do the same for this assignment, however, ALL of the data must be stored in parallel arrays first, two of which will be 2-dimensional, BEFORE any computation may be ne Specifically, you should read the student id number (SID) as before into an array. The tests and programs scores should be loaded into two separate 2D arrays. The 2D array containing the test information will have 3 columns for each student's 3 test scores. Similarly, the 2D array for the program scores will have 6 columns for the 6 program scores. All of this should be done in one function Once the data have been loaded into the 3 parallel arrays, you can proceed to determine the average and the letter grade for each student and store them in parallel arrays, as was done in the previous assignment. Finally, complete the assignment, as before, by generating the numbers of each grade (A, B, C, D, F), and the overall class average as described in the prior assignment

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!