(Computer-Assisted Instruction: Monitoring Student Performance) More sophisticated computer-assisted instruction systems monitor the student’s performance over a period of time. The decision to begin a new topic is often based on the student’s success with previous topics. Modify the program of Exercise 5.57 to count the number of correct and incorrect responses typed by the student. After the student types 10 answers, your program should calculate the percentage that are correct. If the percentage is lower than 75%, display "Please ask your teacher for extra help.", then reset the program so another student can try it. If the percentage is 75% or higher, display "Congratulations, you are ready to go to the next level!", then reset the program so another student can try it.
What will be an ideal response?
```
// Help user practice multiplication;
// check user's progress every 10 responses.
#include
#include
#include
using namespace std;
int generateProblem(); // function prototype
void correctMessage(); // function prototype
void incorrectMessage(); // function prototype
bool checkDone( int, int ); // function prototype
int main()
{
int response = 0; // user response for product
int correct = 0; // total number of correct responses
int incorrect = 0; // total number of incorrect responses
srand( time( 0 ) ); // seed random number generator
// loop until sentinel value read from user
while ( response != -1 )
{
int answer = generateProblem(); // get product
cin >> response; // read user's guess
// loop until sentinel value or correct response
while ( response != -1 && response != answer )
{
++incorrect; // update total number of incorrect responses
if ( checkDone( correct, incorrect ) ) // check progress
{
// done 10 responses; reset for next person
correct = incorrect = 0;
break;
} // end if
incorrectMessage();
cin >> response;
} // end while
// correct response
if ( response == answer )
{
++correct; // update total number of correct responses
if ( checkDone( correct, incorrect ) ) // check progress
{
// done 10 responses; reset for next person
correct = incorrect = 0;
continue;
} // end if
correctMessage();
} // end if
} // end while
cout << "That's all for now. Bye." << endl;
} // end main
// generates new product and displays prompt
int generateProblem()
{
int x = rand() % 10; // generate 1-digit random number
int y = rand() % 10; // generate 1-digit random number
cout << "How much is " << x << " times " << y << " (-1 to End)\n? ";
return x * y; // return product
} // end function generateProblem
// correctMessage randomly chooses response to correct answer
void correctMessage()
{
// generate random number between 0 and 3
switch ( rand() % 4 )
{
case 0:
cout << "Very good!";
break;
case 1:
cout << "Excellent!";
break;
case 2:
cout << "Nice work!";
break;
case 3:
cout << "Keep up the good work!";
break;
} // end switch
cout << endl << endl;
} // end function correctMessage
// incorrectMessage randomly chooses response to incorrect answer
void incorrectMessage()
{
// generate random number between 0 and 3
switch ( rand() % 4 )
{
case 0:
cout << "No. Please try again.";
break;
case 1:
cout << "Wrong. Try once more.";
break;
case 2:
cout << "Don't give up!";
break;
case 3:
cout << "No. Keep trying.";
break;
} // end switch
cout << endl << "? ";
} // end function incorrectMessage
// based on number of correct and incorrect, print
// result and return true if student's turn is over
bool checkDone( int right, int wrong )
{
// if we've reached a total of 10 responses
if ( right + wrong == 10 )
{
// check whether student got 75% correct or not
if ( static_cast< double >( right ) / ( right + wrong ) < .75 )
cout << "Please ask your teacher for extra help.\n\n";
else
cout << "Congratulations, you are ready to go "
<< "to the next level!\n\n";
return true;
} // end if
return false;
} // end function checkDone
```
You might also like to view...
Perform the a priori algorithm on the table of Figure 17.15 to determine all reasonable two-item associations.
What will be an ideal response?
Why is it important to understand how to convert decimal numbers to binary numbers?
What will be an ideal response?
A margin shorthand property can have up to four values. _________________________
Answer the following statement true (T) or false (F)
The _____ describes a system at the beginning of system operation and includes the results of performance and acceptance tests for the operational system.
A. functional baseline B. operational baseline C. allocated baseline D. product baseline