GPAProgram Problem Write a batch processing program to calculate a student’s GPA
ID: 3608853 • Letter: G
Question
GPAProgram
Problem
Write a batch processing program to calculate a student’s GPAfor the last semester.
Specifications
Write detailed, word-processed pseudocode. Refer to the Pseudocodesection of the Homework
Procedures handout. Complete it before writing yourcode.
Usenamed constants to store the names of each data file and openthem.
Tocalculate GPA, multiply the number of units times the grade pointsfor each course, total these
products, and divide this total by the total number ofunits.
Read the number of units (0.5 – 5.0) and grade points (0– 4) for three courses from a data file.
Create the data file using a simple text editor, such as Notepad,WordPad or Dev-C++. Make sure you save it as a text file. InDev-C++, use the command File > New > Source File.
Have the program send the resulting GPA, rounded to two decimalplaces, to a data file rather than the monitor. Include adescriptive label along with the value, such as: The GPA iscalculated to be 3.25.
Usemeaningful identifiers.
Close the data files as soon as possible.
Test your results.
Explanation / Answer
please rate - thanks #include #include int main() { int grade,count=0; float credits,totalcredits=0,totalpoints=0,GPA; ifstream input; ofstream output; input.open("gpa.dat"); //open file if(input.fail()) //is it ok? { coutgrade; //get # of creditsand grade while(!input.eof()) { totalpoints+=credits*grade; totalcredits+=credits; input>>credits>>grade; //get # of creditsand grade } GPA=totalpoints/totalcredits; output.setf(ios::fixed,ios::floatfield); output.precision(2); outputRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.