ASSGINMENT #1
Accounting teachers, being naturally inept with numbers, have a difficult time calculating students’ averages and assigning letter grades at the end of each semester. Your accounting teacher is no exception. To make this end of semester grading easier, and more accurate, he hires you to write a program (C++) to automate the task. There are a variable number of students in his class, with each students grade being calculated as follows:
2 Tests 10% each
Midterm Exam 25%
Final Exam 30%
Term Project 25%
Input data is stored in a file named ClassData.dat. The first line in the input file has the number of students in the class. Each subsequent line contains one student’s Lastname, test-scores, exam scores and project score. Your program should begin by reading the number of students in the class, and then for each student, read the student’s name and test, exam and project scores. The program should then calculate the student’s average and assign him/her a letter grade ("A" for 90-100; "B" for 80-89; "C" for 70-79; and "F" for 69 and below). Finally, for each student, the program should print, to output file, his/her name, average, and grade.
Once all students have been processed, the program should print a summary report stating the number of "A"s, "B"s, "C"s and "F"s assigned.
A couple questions because I'm kinna wondering a few things.
First- I've created a Text file using notepad with the following data:
10
Isaacs 10 8 22 16 22
Brown 7 10 17 11 19
Marley 1 4 21 29 11
Holt 1 2 18 10 17
Washington 1 5 21 8 18
Hammond 3 7 16 14 14
Ellis 8 9 20 30 23
Spear 10 10 25 28 21
Wilson 8 3 22 24 25
Bolo 5 4 23 22 11
I saved it to my Desktop as an .dat File. How do i ask the program to read from left to right the student’s Lastname, 2 test-scores, 2 exam scores and project score? I also need to output for each student, the program should print, to an output file, his/her name, average, and grade...
I'm kinna lost-but i know the program would have near to it's completion:
#include<fstream>
#include<iomanip>
#include<string>
#include<iostream>
using namespace std;
int main()
{
if(gradeAvg>=90)
cout<< "A";
else if (gradeAvg>=80)
cout<< "B";
else if (gradeAvg>=70)
cout<< "C";
else if (gradeAvg>=60)
cout<< "D";
else
cout<< "F";
return 0;
}
Any help is appreciated