I need C++ coding for the following Professor Jones want a program to calculate
ID: 3591485 • Letter: I
Question
I need C++ coding for the following Professor Jones want a program to calculate the student Final Grades The calculation for the final grade is the midterm Exam plus the final Exam divided by 2. The midterm Exam and Final Exam grades must be between 0 and 100. The Letter grade is calculate as follows: 90-100-A; 80 to 90-B; 70 to 80-C; 60 to 70 -C; below 60-F. Also, Professor Jones wants to know the student name and the course number. it Inter to End String 60) courseName letterGrade char else if) else if (finalGradeExplanation / Answer
#include<iostream>
using namespace std;
int main() {
string studentName, courseNumber;
double midtermExam, finalExam;
cout << "Enter Student Name: ";
cin >> studentName;
cout << "Enter course exam: ";
cin >> courseNumber;
cout << "Enter mid term grade ";
cin >> midtermExam;
cout << "Enter Final Grade ";
cin >> finalExam;
if (midtermExam < 0 || midtermExam > 100) {
cout << "Midterm exam must be between 0 and 100 ";
return 1;
}
if (finalExam < 0 || finalExam > 100) {
cout << "Final exam must be between 0 and 100 ";
return 1;
}
double avg = (midtermExam + finalExam)/2.0;
char letterGrade;
if (avg > 90)
letterGrade = 'A';
else if (avg > 80)
letterGrade = 'B';
else if (avg > 70)
letterGrade = 'C';
else if (avg > 60)
letterGrade = 'D';
else
letterGrade = 'F';
cout << "Grade obtained by us is: " << letterGrade << endl;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.