Write a function qualityPoints that inputs a student’s average and returns 4 if a student’s average is 90–100, 3 if the average is 80–89, 2 if the average is 70–79, 1 if the average is 60–69 and 0 if the average is lower than 60.
What will be an ideal response?
```
// Determine quality points on 0 to 4 scale
// for averages in 0 to 100 range.
#include
using namespace std;
int qualityPoints( int ); // function prototype
int main()
{
int average; // current average
// loop for 5 inputs
for ( int loop = 1; loop <= 5; loop++ )
{
cout << "\nEnter the student's average: ";
cin >> average;
// determine and display corresponding quality points
cout << average << " on a 4 point scale is "
<< qualityPoints( average ) << endl;
} // end for
cout << endl;
} // end main
// qualityPoints takes average in range 0 to 100 and
// returns corresponding quality points on 0 to 4 scale
int qualityPoints( int average )
{
if ( average >= 90 ) // 90 <= average <= 100
return 4;
else if ( average >= 80 ) // 80 <= average <= 89
return 3;
else if ( average >= 70 ) // 70 <= average <= 79
return 2;
else if ( average >= 60 ) // 60 <= average <= 69
return 1;
else // 0 <= average < 60
return 0;
} // end function qualityPoints
```
You might also like to view...
A(n) ____________ is a class property that is defined by only a single line of code.
a. auto-implemented property b. inline property c. base property d. derived property
What frequencies does 802.11n use?
A. 2.4 and 5 GHz B. 11 and 54 MHz C. 5 and 24 GHz D. 2.4 and 11 MHz
Briefly describe how to show the same formatted placeholder on multiple slides by customizing the slide master.
What will be an ideal response?
The ____________________ Browser displays all databases on the MySQL server to which you are connected.
Fill in the blank(s) with the appropriate word(s).