Professor Weirdo Willie’s grading scale for this semester is based on whim. Afte
ID: 3623892 • Letter: P
Question
Professor Weirdo Willie’s grading scale for this semester is based on whim. After keying the lowest possible score for an A, B, C, and D letter grades (these are referred to as “break points), the student score is keyed.
Your assignment is to compute and print the correct letter grade for the student. One additional note: Weirdo Willie uses integer calculations. Assume that grades range between 0 and 100, inclusive.
Input Specifications:
First, four numbers giving the lowest possible scores to receive an A, B, C, and D, respectively, followed by a student’s score. Include “reasonable and appropriate” prompts to guide the user when keying these five numbers.
The break point for an A must be greater than the break point for a B, the break point for a B must exceed the break point for a C, and the break point for a C must exceed that for a D. Failure to reach the break point for a D results in letter grade of F.
Additionally, the breakpoint for an A must be evenly divisible by 4, the breakpoint for a B must be evenly divisible by 3, and the break point for a C must be an even integer.
Sample input data follows:
97 45 70 58 86 Invalid Break Point Sequence.
90 81 70 60 93 Invalid Break Point for A grade; 90 is not divisible by 4.
92 78 76 50 74 Score of 74 corresponds to letter grade of D.
88 84 70 60 89 Score of 89 corresponds to letter grade of A.
Program Requirements: Use nested if-else structures.
Explanation / Answer
please rate - thanks
#include <iostream>
using namespace std;
int main()
{int a,b,c,d,score;
cout<<"input breakpoint for A: ";
cin>>a;
cout<<"input breakpoint for B: ";
cin>>b;
cout<<"input breakpoint for C: ";
cin>>c;
cout<<"input breakpoint for D: ";
cin>>d;
cout<<"input score: ";
cin>>score;
if(b>a)
cout<<"Invalid breakpoint sequence ";
else if(c>b)
cout<<"Invalid breakpoint sequence ";
else if(d>c)
cout<<"Invalid breakpoint sequence ";
else if(a%4!=0)
cout<<"Invalid Break Point for A grade; "<<a<<" is not divisible by 4. ";
else if(b%3!=0)
cout<<"Invalid Break Point for B grade; "<<b<<" is not divisible by 3. ";
else if(c%2!=0)
cout<<"Invalid Break Point for C grade; "<<c<<" is not even. ";
else if(score>=a)
cout<<"Score of "<<score<<" corresponds to letter grade of A. ";
else if(score>=b)
cout<<"Score of "<<score<<" corresponds to letter grade of B. ";
else if(score>=c)
cout<<"Score of "<<score<<" corresponds to letter grade of C. ";
else if(score>=d)
cout<<"Score of "<<score<<" corresponds to letter grade of D. ";
else
cout<<"Score of "<<score<<" corresponds to letter grade of F. ";
system("pause");
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.