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

Your math instructor gives three tests worth 50 points each. You can drop one of

ID: 3678120 • Letter: Y

Question

Your math instructor gives three tests worth 50 points each. You can drop one of the test scores. The final grade is the sum of the two best test scores. Assuming the three test scores are input from the keyboard, write an interactive program that asks the user to enter three test scores and then calculates the final letter grade using the following cut-off points. >=90 A <90, >=80 B <80, >=70 C <70, >=60 D < 60 F Input validation: Display an error message if the user enters a score greater than 50 and do not accept negative

Explanation / Answer

This below interactive program will show the error if the test score is above 50 and below 0..

Answer for Question:

#include<iostream>
using namespace std;

int main()
{
   int test1, test2, test3;
   int total = 0;
   cout<<"Enter Test1 Score :"<<endl;
   cin>>test1;
   if(test1 >0 && test1 < 50)
   {
       cout<<"Test1 Score should be less then 50 and greater than 0 :"<<endl;
       cout<<"Re - Enter Test1 Score :"<<endl;
       cin>>test1;
   }
   cout<<"Enter Test2 Score :"<<endl;
   cin>>test2;  
   if(test2 >0 && test2 < 50)
   {
       cout<<"Test2 Score should be less then 50 and greater than 0 :"<<endl;
       cout<<"Re - Enter Test2 Score :"<<endl;
       cin>>test2;
   }
   cout<<"Enter Test3 Score :"<<endl;
   cin>>test3;
  
   if(test3 >0 && test3 < 50)
   {
       cout<<"Test3 Score should be less then 50 and greater than 0 :"<<endl;
       cout<<"Re - Enter Test3 Score :"<<endl;
       cin>>test3;
   }
  
   int sum = test1 + test2 + test3;
   if(sum >= 90)
       cout<<"Grade is A"<<endl;
   else if(sum <90 && sum >=80)
       cout<<"Grade B"<<endl;
   else if(sum <80 & >=70)
       cout<<"Grade C"<<endl;
   else if(sum < 70 && >=60)
       cout<<"Grade D"<<endl;
   else
       cout<<"Grade F"<<endl;
   return 1;
}