Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a C++ program that computes a student\'s grade for an assignment as a perc

ID: 3606283 • Letter: W

Question

Write a C++ program that computes a student's grade for an assignment as a percentage given the student's score and the total points. The final score should be rounded up to the nearest whole value using the ceil function in the cemath> header file. You should also display the floating-point result up to 5 decimals places. The input to the program must come from a file containing a single line with the score and total separated bya space. In addition, you should print to the console "Excellent" if the grade is greater than 90, "Well Done" if the grade is greater than 80, "Good" if the grade is greater than 70, "Need Improvement" if the grade is greater than or equal to 60, and "Fail" if the grade is less than 50. [100 Points I.

Explanation / Answer

#include <iostream>
#include <cmath>
#include <fstream>

using namespace std;

int main ()

{
//input variables
float NumberRight;
float TotalPoints;
float GradePercent;

ifstream inData;

// open file
inData.open ("Grade.in")

// read values
inData >> NumberRight >> TotalPoints;


//calculate values

GradePercent = NumberRight / TotalPoints

cout << "You got a "

if (GradePercent > 90)
{
cout "Excellent" endl;
}

if (GradePercent > 80)
{
cout "Well Done" endl;
}

if (GradePercent > 70)
{
cout "Good" endl;
}
else if (GradePercent >= 60)
{
cout "Need Improvement" endl;
}
else (GradePercent < 50)
{
cout "Fail" endl;
}

return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote