I). Write a program in c++ with class that will help an elementary school student learn multiplication. Use the rand functionto produce two positive one-digit integers. The program should then prompt the user with a question, such as How much is 6times 7? The student then inputs the answer. Next, the program checks the student's answer. If it's correct, display themessage "Very good!" and ask another multiplication question. If the answer is wrong, display the message "No. Please tryagain." and let the student try the same question repeatedly until the student finally gets it right. A separate function shouldbe used to generate each new question. This function should be called once when the application begins execution and eachtime the user answers the question correctly.

Question
Asked Jan 25, 2020
73 views

I). Write a program in  c++ with class  that will help an elementary school student learn multiplication. Use the rand function to produce two positive one-digit integers. The program should then prompt the user with a question, such as How much is 6 times 7? The student then inputs the answer. Next, the program checks the student’s answer. If it’s correct, display the message "Very good!" and ask another multiplication question. If the answer is wrong, display the message "No. Please try again." and let the student try the same question repeatedly until the student finally gets it right. A separate function should be used to generate each new question. This function should be called once when the application begins execution and each time the user answers the question correctly.

I). Write a program in c++ with class that will help an elementary school student learn multiplication. Use the rand function
to produce two positive one-digit integers. The program should then prompt the user with a question, such as How much is 6
times 7? The student then inputs the answer. Next, the program checks the student's answer. If it's correct, display the
message "Very good!" and ask another multiplication question. If the answer is wrong, display the message "No. Please try
again." and let the student try the same question repeatedly until the student finally gets it right. A separate function should
be used to generate each new question. This function should be called once when the application begins execution and each
time the user answers the question correctly.
help_outline

Image Transcriptionclose

I). Write a program in c++ with class that will help an elementary school student learn multiplication. Use the rand function to produce two positive one-digit integers. The program should then prompt the user with a question, such as How much is 6 times 7? The student then inputs the answer. Next, the program checks the student's answer. If it's correct, display the message "Very good!" and ask another multiplication question. If the answer is wrong, display the message "No. Please try again." and let the student try the same question repeatedly until the student finally gets it right. A separate function should be used to generate each new question. This function should be called once when the application begins execution and each time the user answers the question correctly.

fullscreen
check_circle

Expert Answer

Step 1

A C++ program for the practice of multiplication is given as follows,

File name: “main.cpp”

//Declare header files

#include <iostream>

#include <cmath>

#include <cstdlib>

//Decclare the method

int askQ();

//Declare namespace

using namespace std;

//Define the main() function

int main ()

{

    //Declare the variables

    int userNum,num;

    //Call the method to get the multiplied value

    num = askQ();

    //Execute while true

    while(true)

    {

        //Get the answer input from the user

        cin>>userNum;

        //Check whether the user answer and the multipied value is same

        if(userNum==num){

            //Print the message

            cout<<"Very good!"<<endl;

            //Call the method to ask the question and return the answer

            num = askQ();

        }

        //Otherwise

        else

        {

            //Print the message

            cout<<"No. Please try again."<<endl;

        }

    }

}               

//Define the method

int askQ(){

    //Generate two random numbers

    int rand_int1 =(rand() %10);

    int rand_int2 = (rand() %10);

    //Ask the question

    cout<<"How much is "<< rand_int1<<  " times "<<rand_int2<<  "?"<<endl;

    //Return the multiplied value

    return rand_int1*rand_int2;

}

Screenshot of program #1:

Computer Science homework question answer, step 1, image 1
fullscreen
Step 2

Screenshot of program #2:

Computer Science homework question answer, step 2, image 1
fullscreen
Step 3

Screenshot of program #3...

Computer Science homework question answer, step 3, image 1
fullscreen

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in

Engineering

Computer Science

Related Computer Science Q&A

Find answers to questions asked by student like you
Show more Q&A
add
question_answer

Q: Create a MySQL Database called “CSC306Class”. Create three (3) tables in the database called “studen...

A: CREATE DATABASE:A new SQL database is created using the CREATE DATABASE statement.Syntax:CREATE DATA...

question_answer

Q: What is the file extension for JSON? name.xml name.JSON name.java name.py

A: The correct option is name.JSONJSON is abbreviated as Java Script Object Notation.A JSON file is a f...

question_answer

Q: Write a program that reads a list of integers, and outputs whether the list contains all even number...

A: A C++ program that reads a list of integers, and outputs whether the list contains all even numbers,...

question_answer

Q: Im working on homework and am stuck. I have created the code for taking the input of the user but I ...

A: Create a class named MainClassDeclare 2 dimensional array of students which contains 10 students, ea...

question_answer

Q: Design a class named Employee. The class should keep the following information infields:• Employee n...

A: Program:Filename: “Test.java”public class Test{   public static void main(String args[])   {    Prod...

question_answer

Q: Method: sumOdds(value: int): This method will sum all the odd values from 1 upto the value passed by...

A: A Python code for the given methods is as follows,File name: “main.py”import randomdef sumOdds(value...

question_answer

Q: Using the provided Rental Car Transaction Java Classes  - Load the data to produce the results simil...

A: A “RentalCarTransaction.java” file is as follows,import java.time.LocalDate;public class RentalCarTr...

question_answer

Q: Provide the code to create an input box for a data field named custPassword, with an input type suit...

A: The code and explanation to create an input box for a data field named custPassword of password type...

question_answer

Q: 13.5 (Enable GeometricObject comparable) Modify the GeometricObject class to implement the Comparabl...

A: Unified Modeling Language (UML) class diagram: