0% found this document useful (0 votes)
11 views2 pages

Document

Uploaded by

Dean John
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views2 pages

Document

Uploaded by

Dean John
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

#include <iostream>

using namespace std;

int main() {

double exam1, exam2, exam3, bonus, totalScore, finalGrade;

cout << "Welcome to the Grade Calculator Program!" << endl;

cout << "Please enter your score for Exam 1 (out of 100): ";

cin >> exam1;

cout << "Please enter your score for Exam 2 (out of 100): ";

cin >> exam2;

cout << "Please enter your score for Exam 3 (out of 100): ";

cin >> exam3;

cout << "Please enter the bonus points earned (out of 5): ";

cin >> bonus;

if (exam1 < 0 || exam1 > 100 || exam2 < 0 || exam2 > 100 || exam3 < 0 || exam3 > 100) {

cout << "Invalid exam score. Please enter scores between 0 and 100." << endl;

return 1;

if (bonus < 0 || bonus > 5) {

cout << "Invalid bonus points. Please enter a value between 0 and 5." << endl;

return 1;

totalScore = exam1 + exam2 + exam3 + bonus;


finalGrade = totalScore / 100;

cout << "Calculating..." << endl;

cout << "Your total score is: " << totalScore << endl;

cout << "Based on your performance, your final grade is: ";

if (finalGrade >= 90-100) {

cout << "A" << endl;

} else if (finalGrade >= 80-89) {

cout << "B" << endl;

} else if (finalGrade >= 70-79) {

cout << "C" << endl;

} else if (finalGrade >= 60-69) {

cout << "D" << endl;

cout << "Congratulations!" << endl;

return 0;

You might also like