Deciding the Final Grads of various students manually is a tedious and challenging task.
Statement:
Deciding the Final Grads of various students manually is a tedious and challenging task. Your job is to develop a C++ program that should be capable of calculating the Total and Average Marks of a student. Based on the above calculations the program should award the correct Final Grad to a student.
The program should allow the users to enter their OWN VU-ID and any random marks for four subjects CS, Math, Pak Study, and MGT. Then, the Total marks and Average Marks are calculated using mathematical operators on variables for each subject. The program should use Control Structure “if or ifelse” and “Logical Operator(s)” to decide the final grad of a student based on the Average Marks. Also, the following score limits should be implemented in your program to grant Correct grad to a student as per the following upper and lower score bounds/limits. For example, if a student got Average Marks 86 then Grad “A- “should be awarded
Lower and upper bounds for grads:
91 to100 => Grad: A+
81 to 91 => Grad: A71 to 81 => Grad: B+
61 to 71 => Grad: B51 to 61 => Grad: C
41 to 51 => Grad: D
35 to 41 => Grad: E
34 to 0 => Fail
Program:
#include <iostream>
using namespace std;
int main() {
string vuID;
int csMarks, mathMarks, pakStudyMarks, mgtMarks;
// Input section
cout << "Enter VU-ID: \n";
cin >> vuID;
cout << "Enter CS marks: \n";
cin >> csMarks;
cout << "Enter Math marks: \n";
cin >> mathMarks;
cout << "Enter Pak Study marks: \n";
cin >> pakStudyMarks;
cout << "Enter MGT marks: \n";
cin >> mgtMarks;
// Calculation section
int totalMarks = csMarks + mathMarks + pakStudyMarks + mgtMarks;
float averageMarks = totalMarks / 4.0;
// Grade determination section
string finalGrade;
if (averageMarks >= 91 && averageMarks <= 100) {
finalGrade = "A+";
} else if (averageMarks >= 81 && averageMarks < 91) {
finalGrade = "A";
} else if (averageMarks >= 71 && averageMarks < 81) {
finalGrade = "B+";
} else if (averageMarks >= 61 && averageMarks < 71) {
finalGrade = "B";
} else if (averageMarks >= 51 && averageMarks < 61) {
finalGrade = "C";
} else if (averageMarks >= 41 && averageMarks < 51) {
finalGrade = "D";
} else if (averageMarks >= 35 && averageMarks < 41) {
finalGrade = "E";
} else {
finalGrade = "Fail";
}
// Output section
cout << "VU-ID: " << vuID << endl;
cout << "Total Marks: " << totalMarks << endl;
cout << "Average Marks: " << averageMarks << endl;
cout << "Grade: " << finalGrade << endl;
return 0;
}
No comments