// Zeinalipour-Yazti Demetrios // csyiazti // cs10xx - // Lab Sec#24, #29, #30 // lab4 /* Simple "Students Letter Notifier" This program determines what students need to have a letter of notification sent to them. The course is dependent on two tests. It initially asks the user what are the maximum points for each of the two tests. Then for each student it asks the user to enter both scores. The program doesn't need to know a'priori the number of students in the class. The user is given a way to terminate the input student scores. As each set of test scores is inputed the program displays if a student needs a notification letter and what type. Students get notification letters for the following reasons: Honors notification: Grade of 95% or higher Warning notification: D grade Failure notification: F grade */ #include using namespace std; void main() { // declare variables char answer; // user's answer to question if he wants to go on again int max_points1; // maximum points for test1 int max_points2; // maximum points for test2 int points1; // user's points for test1 int points2; // user's points for test2 int avg; // user's average grade int counter = 0; // counts number of users // greeting cout << "Students Letter Notifier by Demetris Zeinalipour - Lab 4 \n\n"; // get the maximum test1 & test2 score cout << "What is the maximum score for Test #1? : "; cin >> max_points1; cout << "What is the maximum score for Test #2? : "; cin >> max_points2; // run the program for as many userstimes as the user wants do { // increase user's counter counter++; cout << "\n\nEnter student's " << counter << " score for Test #1? : "; cin >> points1; cout << "Enter student's " << counter << " score for Test #2? : "; cin >> points2; // calculate user's average (do float division) avg = static_cast(points1 + points2) / static_cast(max_points1 + max_points2); // scale average to 100 percentage range avg *= 100; cout << "Users average = " << avg << "\n"; // decisions of letters are based on the following 3 conditions if (avg>=95) { cout << ">\tHonors notification: Grade of 95% or higher!\n"; } else if ((avg<=60) && (avg>=70)) { cout << ">\tWarning notification: D grade\n"; } else if (avg<50) { cout << ">\tFailure notification: F grade!\n"; } else { cout << ">\tNo notification!\n"; } do // this loop ensures that the answer is y/n { cout << "\nDo you want to proceed to the next student? (y/n) : "; cin >> answer; if (answer!='y' && answer!='n') { cout << "Error! : Only (y/n) are valid entries!\n"; } } while (answer!='y' && answer!='n'); } while (answer=='y'); }