Question: Please finish the following c++ code by adding the remaining structs getTotal & getGrades getTotal: should get the addition from test1(20%), test2(20%), lab(15%), quiz(30%), final(30%)

Please finish the following c++ code by adding the remaining structs getTotal & getGrades

getTotal: should get the addition from test1(20%), test2(20%), lab(15%), quiz(30%), final(30%) and divide them by (10) to get a grade from (1.00-10.00)

getGrade: Use switch method to assign a letter grade based on their total grade (1.00-10.00)

The program must get access from a txt file (scores.txt), and output the information in another txt file (studentout.txt)

scores.txt must contain this info:

Name Test1 test2 lab quiz final total grade

Ram M. Garza 98 94 89 96 94

Matt T. Mills 67 63 61 67 60

Miguel Z. Garcia 77 71 79 68 70

Omar T. Smith 83 80 81 89 85

Laura M. Moore 55 56 57 60 63

Please finish the following c++ code by adding the remaining structs getTotal

Same code in txt:

#include

#include

#include

#include

#include

using namespace std;

struct studentType

{

string first_name;

string middle_name;

string last_name;

int test1;

int test2;

int lab;

int quiz;

int final;

int total;

char grade;

};

const int SIZE = 5;

void openInputFile(ifstream &, string, studentType[]);

void getTotal(studentType[]);

void getGrade(studentType[]);

void print(studentType[]);

int main()

{

studentType students[SIZE];

int count = 0;

ifstream inFile;

string inFileName = "scores.txt";

openInputFile(inFile, inFileName, students);

//getTotal(students);

//getGrades(students);

print(students);

cout

return 0;

}

void openInputFile(ifstream &inFile, string inFileName, studentType str[SIZE])

{

inFile.open(inFileName);

if (!inFile)

{

cout

cout

return;

}

else

{

for (int count = 0; count

{

inFile >> str[count].first_name >> str[count].middle_name >> str[count].last_name

>> str[count].test1 >> str[count].test2 >> str[count].lab

>> str[count].quiz >> str[count].final;

}

}

inFile.close();

}

void print(studentType arr[])

{

ofstream out("studentout.txt");

cout

cout

out

out

for (int i=0; i

{

string name;

name = arr[i].first_name + " " +arr[i].middle_name + " " + arr[i].last_name;

cout

//

cout

out

//

out

}

}

include 7 using nanespace std; 9 estruct studentType string first_nane string niddle_nane string last nane nt testl; nt test2; int 1ab int quiz int final; int total char grade; const int Size5 25 void openIrputFile(ifstream &, string, student Type[]): 26 Void getTotal (studentType]) void getorade(studenttype]); 28 void print(student Type[) 32 tudentType students [SIZE]; nt count-8 35 ifstrean inFile string inFileNane "scons.txt openInputFile(inFile, inFileNane, students); //getTotal(students): print (students) court openInputFile(ifstream &inFile, tring inFilelians, tudentType str(SIZE]) inrile.open inrilewane); if (inFile) cout str[count].first nane str[count].niddle name str[count].last_name str[count].testi str[count].test2 str[count].lab str[count].quiz str[count]-final; 65 inrile.close); void print (student Type arrl) ofstrean out( studentout.txt); cout

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!