Write a grading program for a class with the following grading policies, using s
ID: 3548224 • Letter: W
Question
Write a grading program for a class with the following grading policies, using structures.
1. 1.There are two quizzes each graded on the basis 10 points (0-10), an integer data type.
2. 2.There is one midterm exam and one final exam, each graded on the basis of 100 point (0-100), a float data types
3. 3.The final exam countes for 50% of the final grade, the midterm exam counts for 25% and the two quizzes together count for total of 25%
(Normalize the quiz scores they should be converted to a [percentage before they are average in)
Use the usual grading scale that we have used throughout the semester for assigning letter grades. The program will read in the student scores ( total 4scores) from a text file (ln.txt) and output the students records describe below. The results will be written to a file called (out.txt)
ln.txt
Franks 10 9 96.0 88.5
Jones 8 9 88.5 83.0
Merrill 8 7 66.0 69.5
Smith 9 10 95.2 93.6
Wilson 7 8 76.0 74.5
Explanation / Answer
please rate - thanks
any changes needed let me know
tested with DEV C++
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{int quiz1,quiz2;
float midterm,final,grade;
char letter;
string name;
ifstream in;
ofstream out;
in.open("in.txt");
if(in.fail())
{ cout<<"input file did not open please check it ";
system("pause");
return 1;
}
out.open("out.txt");
out<<"name Quiz 1 Quiz 2 midterm final Grade Letter ";
in>>name;
while(in)
{in>>quiz1>>quiz2>>midterm>>final;
grade=(quiz1/10.*100.+quiz2/10.*100.)/2.*.25+midterm*.25+final*.5;
if(grade>=90)
letter='A';
else if(grade>=80)
letter='B';
else if(grade>=70)
letter='C';
else if(grade>=60)
letter='D';
else
letter='F';
out<<name<<" "<<quiz1<<" "<<quiz2<<" "<<midterm<<" "<<final<<" "
<<grade<<" "<<letter<<endl;
in>>name;
}
out.close();
in.close();
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.