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

Write a program to prompt the user to enter a grade between 0 and 100 _ If the g

ID: 3542540 • Letter: W

Question

Write a program to prompt the user to enter a grade between 0 and 100

_ If the grade is not between 0 and 100 display an error message

_ Display the proper letter grade based on the number entered (A,B,C, D, F)

_ Before determining the letter grade, do the following:

o After entering the grade ask, the user if the grade is eligible for extra credit.

o If the user enters y or Y add 5 points the grade entered

o It the user enters n or N leave the grade alone

o If they enter any other letter subtract 10 points for not following instructions.


Example Run:

Number to Letter Grade

Enter a Number Grade: 87

Eligible for Extra Credit? y

Your grade of 92.00 = A

Explanation / Answer

#include<iostream>


wsing namespace std;


int main()

{


int grade;

char ch;


cout<<"Enter a Number Grade:";

cin>>grade;


if(grade<0||grade>100)

{

cout<<"Wrong value of grade entered";

exit(0);

}


cout<<"Eligible for Extra Credit?";

cin>>ch;


if(ch=='y'||ch=='Y')

grade += 5;

else if(ch=='n'||ch=='N')

{ }

else

grade -= 10;


if(grade<0||grade>100)

{

cout<<"Wrong value of grade after credit calculation";

exit(0);

}


if(grade>=60)

{

if(grade>=70)

{

if(grade>=80)

{


if(grade>=90)

{

cout<<"Your grade of "<<grade<<" = A";

}

else

cout<<"Your grade of "<<grade<<" = B";

}

else

cout<<"Your grade of "<<grade<<" = C";

}

else

cout<<"Your grade of "<<grade<<" = D";

}

else

cout<<"Your grade of "<<grade<<" = F";

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