Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management With Website Development Applications

Authors: Greg Riccardi

1st Edition

0201743876, 978-0201743876

More Books

Students also viewed these Databases questions

Question

list the major theories and philosophies of motivation

Answered: 1 week ago

Question

Explain the different types of marketing strategies.

Answered: 1 week ago

Question

Explain product positioning.

Answered: 1 week ago

Question

Explain Industrial market segment.

Answered: 1 week ago