Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PLEASE READ THE ENTIRE POST BEFOREANSWERING. THE SOLUTION SHOULD BE AN ADDITON T

ID: 3540124 • Letter: P

Question

PLEASE READ THE ENTIRE POST BEFOREANSWERING. THE SOLUTION SHOULD BE AN ADDITON TO THE SKELETON ALREADY POSTED. I JUST NEED THE CODE FOR THE MULTIPLICATION FUNCTION ADDED TO THE EXISTING CODE. PLEASE ASK ANY QUESTIONS. I AM HAVING A VERY DIFFICULT TIME WITH THIS PROBLEM, THANKS FOR LOOKING :)




Develop a C++ program that teaches elementary school students multiplication. Use the random module/function to produce two positive one-digit integers. It should then type a question such as:


How much is 6 times 7?


The student then types the answer. Your program checks the answer; if it is correct, the correctMessage function is called; if it is incorrect, the incorrectMessage function is called. Your program will count the number of correct and incorrect answers. After 10 answers (any/all responses count), the program will calculate the percentage of correct responses. If the percentage is lower than 75%, your program will call the needHelp function, then terminate. Otherwise, the program continues until the student enters the sentinel value (-1) to end the program.

Explanation / Answer

please rate - thanks


some things were unclear, any problems, tell me what they are, and I'll fix


// Helps user practice multiplication;
// Check user's progress every 10 responses.

//PROGRAM SKELETON ;

#include <iostream>
using std::cin;
using std::cout;
using std::endl;

#include <cstdlib>
using std::rand;
using std::srand;

#include <ctime>
using std::time;

void multiplication(); // function prototype for the function you are programming!
void correctMessage(); // function prototype%u2026%u2026..do not change
void incorrectMessage(); // function prototype%u2026%u2026.do not change
bool needHelp( int, int ); // function prototype%u2026%u2026.do not change

int main() // do not change
{
   srand( time( 0 ) ); // seed random number generator
   multiplication(); // begin multiplication practice
   return 0; // indicate successful termination

} // end main

// Look below on following pages for functions
// By putting each on separate page, it is easier to print out, then layout on the table to trace the flow


// function multiplication produces pairs of random numbers and prompts the user for the product
//    it also produces random comments for correct and incorrect answers by calling the appropriate function
//    in addition, it counts the number of correct and incorrect answers, and
//    after 10 answers, it calculates the percentage of correct answers;
//   if the percentage is lower than 75%, it calls the function needHelp and terminates.

void multiplication()
{
   // Variable declarations; no other variables are required.
   int x; // first factor
   int y; // second factor
   int response = 0; // user response for product
   int correct = 0; // total number of correct responses
   int incorrect = 0; // total number of incorrect responses
   int count = 0; // count for every 10 responses
do
{correct = 0;
incorrect = 0;
for(count=1;count<=10;count++)
{x=rand()%9+1;
   y=rand()%9+1;
   cout<<"How much is "<<x<<" times "<<y<<"? ";
   cin>>response;
   if(response==x*y)
       {correct++;
        correctMessage();
        }
   else
       {incorrect++;
       incorrectMessage();
       }
}
    if(needHelp(correct,incorrect))
         {cout << "That's all for now. Bye." << endl;
         return;
         }
       cout<<"to exit enter -1 to continue enter 0 ";
              cin>>response;
    }while(response!=-1);
} // end function multiplication

// function 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



// function 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



// function needHelp returns true if < 75% right
bool needHelp( int right, int wrong )
{
   // if < 75% right
   if ( static_cast< double > ( right ) / ( right + wrong ) < .75 )
   {
      cout << "Please ask your instructor for extra help." << endl;
      return true;
   } // end if
   else // otherwise, return false
      return false;
} // end function needHelp

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote