1) Write a c++ program to read a series of integers representing a series of grades from a file. Read the data using an end-of-file loop for the outer loop.

2) Each line represents the grades for a student, for example, the following
87 78 91 83 1011111 85 95 100 90

3) The grading scale is 10% for homework, 20% for programs, 45% for the two highest hourly exams, and 25% for the final. The number of program and hourly exam grades is based on a symbolic constant in the program. The program should be written using symbolic constants so that it is easy to modify (1) if the number of homework changes, (2) if the number of programs changes.

There should be two inner loops. The first loop reads the homework grades in character form and converts to a number. It is based on the symbolic constant 7.
1 is pass, 0 is fail. Sum the grades as you read and convert them.
The second loop reads the program grades (based on the symbolic constant of 4. As you read the program grades, you should sum them.

5) Three decisions are needed. The first will drop the lowest homework grade(if seven homework assignments are given, the grade would be based on six) The second will find the lowest of the hourly exams (the lowest will be dropped).
The third will translate an integer grade into a letter grade (see #3 above for the grading scale).

6) Read the data as integer (except for the bits for the homework grades), and do floating point division and rounding to calculate the final grade. To round the floating point calculations to an integer, add 0.5.

7) the output will be the numeric grade and the letter grade for each student. For the example above, the final answers will be as follows:
The numeric grade is 90, the letter is A.
(The numeric grade was 89.775, which rounded up to 90.)
Write the answer in a data file. Also, echo print the input data. The grades should be written in the form of a table with appropriate headings.

8) Use format for the numeric output. The algorithm will be discussed in more detail in class. The program should work for any data set, not just the data set given. Do not use arrays or strings to process the homework or programs.

OUTPUT: The numeric and letter grade for each student, with an appropriate message. The numeric grade should be formatted.

Data for Program 1:
Final Exam Three Hourly Exams Homework Programs
76 67 83 49 1111111 75 85 70 90
92 87 91 73 0110101 85 95 100 95
98 91 95 87 1111101 100 100 100 95

Output for Program 1:
Final Exam Three Hourly Exams Homework Programs Number Letter
76 67 83 49 7 85 95 100 85 ---- ----

This is what I have so far
Could you guys help me write the program?

#include <iostream>
#include <string>
#include <cmath>
using namespace std;

const int NUMHOMEWORK = 7; //use to control bitmap loop
const int NUMPROGRAMS = 4; //use to control program loop
const float MAXPROGRAMS = 400.0;
const char ASCIICONVERT = 0X0F;

int main()
{
int finalExam;
int hourlyExam;
int homework;
int program;

cout << "Enter the FINAL EXAM grade: ";
cin >> finalExam;
cout << endl;

cout << "Enter the 3 HOURLY EXAM grades with spaces between each one: ";
cin >> hourlyExam >> hourlyExam >> hourlyExam;
cout << endl;

system("pause");
return 0;
}
Topic archived. No new replies allowed.