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...
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...
(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...
Python Object oriented programming
Exercise 3 Dictionary Computers are playing an increasing role in education. Write a program that will help an elementary school student to learn English. To simplify the model, the program will first teach numbers from 1 to 10, colors and fruits. It will use a dictionary to store the pairs Spanish-English words. dataTable-uno':one,'dos':'two....' rojo':'red','blue':'Azul... manzana': apple, nara nja:orange. When running your program, it should get a random Spanish word from the dictionary dataTable and then show...
Android / Java / Please Upload your homework. Copy the screenshot and then paste it to this word document. Then zip your word file and java files. Note: if your android project is too big, you can just zip all of the needed xml files and java files. Computer-Assisted Instruction App) Create an app that will help an elementary school student learn multiplication. Select two positive one-digit integers. The app should then prompt the user with a question, such as...
Need help with this C program? I cannot get it to compile. I have to use Microsoft Studio compiler for my course. It's a word game style program and I can't figure out where the issue is. \* Program *\ // Michael Paul Laessig, 07 / 17 / 2019. /*COP2220 Second Large Program (LargeProg2.c).*/ #define _CRT_SECURE_NO_DEPRECATE //Include the following libraries in the preprocessor directives: stdio.h, string.h, ctype.h #include <stdio.h> /*printf, scanf definitions*/ #include <string.h> /*stings definitions*/ #include <ctype.h> /*toupper, tolower...