Question: Create a module called qualityPoints that takes in an average and returns an integer. The prototype is shown below: int qualityPoints( float average ); The
Create a module called qualityPoints that takes in an average and returns an integer. The prototype is shown below:
int qualityPoints( float average );
The algorithm for the module is as follows:
The module returns 4 if the average is between 90-100
The module returns 3 if the average is between 80-89
The module returns 2 if the average is between 70-79
The module returns 1 if the average is between 60-69
The module returns 0 if the average is between 0-59
In your main program, ask the user for their average. Also make sure that they cant enter a negative average or an average greater than 100. Keep looping until they enter a valid average. Print the average quality points for the class as well.
Then call your module qualityPoints. Print out the students quality points in the main program, NOT the module.
Sample Execution:
Enter your grade (-1 to quit): -10
Error. Grade must be positive (or -1 to quit)> 100
Enter your grade: 90
You got 4 quality points
Enter your grade: 57
You got 0 quality points
Enter your grade: 101
Error. Grade must be less than equal to 100
Enter your grade: 60
You got 1 quality point
Enter your grade: -1
Your average quality points was: 1.67
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
