Programming in C:
Write a program that will help an elementary school student learn multiplication. Use the random number generator to produce two positive integers between 1 and 12 inclusive. It should then type a question such as:
How much is 6 times 7?
The student then types the answer. Your program checks the students’ answer. If it is correct, print a message such as Very good! If the answer is wrong, print a message such as No. Please try again. Let the student try the same question again repeatedly until the student gets it right. After the student has answered correctly, ask if the student would like another question. If the student answers y for yes, the student is given another multiplication problem. If the student answers n for no, the program ends.
Use the following structure for your program:
void multiplication (void);
Function correctMessage will have a prototype like the following:
void correctMessage(void);
Function incorrectMessage will have a prototype like the following:
void incorrectMessage(void);
Program:
#include<stdio.h>
#include <time.h>
//function prototypes
void multiplication(void);
void correctMessage(void);
void incorrectMessage(void);
int main()
{
//varaible declarations
int repeat = 1;
int x, y;
int answer;
char choice;
//provide seed to the random number generator
srand(time(NULL));
//repeat the execution until the user wishes to
exit
do
{
//invoke the multiplication
function
multiplication();
//prompt and read if the user
wishes to repeat
printf("Would you like to have
another question (y/n)? ");
scanf("%s", &choice);
//if user entered n, then set
repeat to 0 to terminate the loop
if(choice == 'n' || choice ==
'N')
repeat =
0;
//else set repeat to 1 to continue
the loop
else
repeat =
1;
printf("\n");
}while(repeat == 1);
printf("Good bye...");
return 0;
}
//function that gives a multiplication question to the user and
reads the answer
void multiplication(void)
{
int x, y, msg;
int isCorrect = -1;
int upper = 12, lower = 1;
int answer;
//generate two random numbers between 1 and 12
x = (rand() % (upper - lower + 1)) + lower;
y = (rand() % (upper - lower + 1)) + lower;
//repeat the loop until the user gives correct
answer
do
{
//ask the user a question
printf("How much is %d times %d? ",
x, y);
//read the answer
scanf("%d", &answer);
//if the answer is correct
if(x * y == answer)
{
//print correct
message
correctMessage();
printf("\n");
isCorrect =
1;
}
//if the answer is incorrect
else
{
//print
incorrect message
incorrectMessage();
printf("\n");
}
}while(isCorrect == -1);
}
//function that print a message when user entered correct
answer
void correctMessage(void)
{
//generate a number between 1 and 5 and print a
message
int upper = 5, lower = 1;
int msg = (rand() % (upper - lower + 1)) +
lower;
switch(msg)
{
case 1:
printf("Very
good!");
break;
case 2:
printf("Excellent!");
break;
case 3:
printf("Nice
work!");
break;
case 4:
printf("keep up
the good work!");
break;
case 5:
printf("Good
work!");
break;
}
}
//function that print a message when user entered incorrect
answer
void incorrectMessage(void)
{
//generate a number between 1 and 5 and print a
message
int upper = 5, lower = 1;
int msg = (rand() % (upper - lower + 1)) +
lower;
switch(msg)
{
case 1:
printf("No.
Please try again.");
break;
case 2:
printf("Wrong.
Try once more.");
break;
case 3:
printf("Don't
give up!'");
break;
case 4:
printf("No. Keep
trying.");
break;
case 5:
printf("Better
luck next time.");
break;
}
}
Output:

Program Screenshot:




Let me know if you have any concerns with the above solution.
Programming in C: Write a program that will help an elementary school student learn multiplication. Use...
Write a JAVASCRIPT program that will help an elementary school student learn multiplication. Use the Random method to produce two positive one-digit integers. The program should then prompt the user with a question using random numbers, such as How much is 6 times 7? The student then inputs the answer. Next, the program checks the student’s answer. If it is correct, display the message "Very good!" and ask whether the student wants to continue if so then ask another multiplication...
Java Programming Write a program that will help a student learn multiplication. Use SecureRandom object to produce two positive integers between 1 and 20. The program should then prompt the user with a question (use a sentinel-controlled loop), such as: How much is 10 times 11? The student then inputs the answer. If the answer is correct display the message “very good” and ask another question. If the answer is wrong to display the message “no, please try again” and...
Write a program that will help a student learn multiplication. Use SecureRandom object to produce two positive integers between 1 and 20. The program should then prompt the user with a question (use a sentinel-controlled loop), such as: How much is 10 times 11? The student then inputs the answer. If the answer is correct display the message “very good” and ask another question. If the answer is wrong to display the message “no, please try again” and let the...
Write In JAVA: Part 1 The use of computers in education is referred to as computer-assisted instruction (CAI). Write a program that will help an elementary school student learn multiplication. Use a SecureRandom object to produce two positive one-digit integers (you will need to look up how to do this). 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...
Please put the outputs with it also I want to make sure it
runs thanks
Project-Computer-Assisted Instruction (50 points) use of computers in education is referred to as computer-assisted instruction (CAl) should then Writ e a program that will help an elementary school student learn multiplication. Use the rand function to produce two positive one-digit integers. The program prompt the user with a question, such as How much is 6 times 7? The student then inputs the answer. Next, the...
Using Python, write an application that tests an elementary school student on their basic math skill. The program should generate random equations to be solved with numbers between 0 and 12. The student should be told if they are correct or incorrect. If the user enters the word DONE, the program should end by telling the student their average (i.e. if they correctly answer 4 out of 8 problems, their average would be 50%). To help modularize you code, create...
C Programming Homework Question 1. The task is to demonstrate the knowledge of using conditional statements and loops. The following incomplete command line-based program was written to mimic a simple calculator. At the current state, the program reads the first number (operand-1) digit by digit and allows the user to select the type of operation. #include <stdio.h> int main() { int count1=0, value=0, number1=0, operation=0; printf("Enter the first operand, one digit at a time ... or enter -1 to stop...
(c++) Write a program that generates a random number between 1 and 100 and asks the user to guess what the number is. If the user’s guess is higher than the random number, the program should display “Too high, try again.” If the user’s guess is lower than the random number, the program should display “Too low, try again.” The program should use a loop that repeats until the user correctly guesses the random number. Be sure that your program...
So I can not get this to work properly and he does not want us using an array list. Below is the directions along with the code I have(Im not sure the code is in the right format) ITSE 2321 – OBJECT-ORIENTED PROGRAMMING JAVA Program 7 – Methods: A Deeper Look Write a program that will help an elementary school student learn multiplication. Use a SecureRandom object to produce two positive one-digit integers. The program should then prompt the student...
Create a web page that will help students practice math - Addition, Subtraction, Multiplication and Division. The page should generate and display a math problem using 2 random numbers from 1 to 12. Addition: [1 - 12] + [1 - 12] = [2 - 24]<-Calculated Subtraction: [2 - 24]<-Calculated - [1 - 12] = [1 - 12] Multiplication: [1 - 12] * [1 - 12] = [1 - 144]<-Calculated Division: [1 - 144]<-Calculated / [1 - 12] = [1 -...