Problem E2 Write a program that determines a student\'s letter grade. Allow the
ID: 3669031 • Letter: P
Question
Problem E2
Write a program that determines a student's letter grade. Allow the user to enter three test scores. The maximum score on each test is 100 points. Determine the letter grade from the average of the test scores, using the following:
90% or more A
80% or more, but less than 90% B
70% or more, but less than 80% C
60% or more, but less than 70% D or F, to be determined from additional information
less than 60% F
Only if the grade needs to be determined between D and F, allow the user to enter the number of homework assignments the student turned in, and the total number of homework assignments. If more than 80% of the homework assignments were turned in, the letter grade is D, otherwise F.
Test it 4 times:
96 84 90
95 83 90
70 59 60 with 5 homework out of 6 turned in
73 58 65 with 8 homework out of 11 turned in
Compute the results by hand and check your results.
(C++, I USE CODEBLOCKS)
Explanation / Answer
#include <iostream>
using namespace std;
int main()
{
int test1,test2,test3,total;
int i,n;
cout<<"Enter the marks of three test::";
cin>>test1>>test2>>test3;
if(test1>100||test2>100||test3>100)
cout<<"Maximum marks in test is 100. Please try again";
total = test1+test2+test3;
if(total>=300*0.9)
cout<<"A";
else if(total>=300*0.8)
cout<<"B";
else if(total>=300*0.7)
cout<<"C";
else if(total>=300*0.6)
{
cout<<"Enter number of assignments you were required to submit::";
cin>>n;
cout<<"How many of them you submitted? ";
cin>>i;
if(i*1.0/n > .80)
cout<<"D";
else
cout<<"F";
}else
cout<<"F";
cout<<endl;
return 1;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.