Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This project is written in five parts. One part is due each week of the course. There is an executable file, MathPractice.exe, which shows a

This project is written in five parts. One part is due each week of the course.

There is an executable file, MathPractice.exe, which shows a completed version of the program. Your campus computers should have sufficient supporting files to run MathPractice.exe, but, if not, weve provided screen shots of each stage.

For this project, you will create a program that will test the users proficiency at solving different types of math problems. The program will be menu driven. The user will select either addition, subtraction, multiplication or division problems. The program will then display a problem, prompt the user for an answer and then check the answer displaying an appropriate message to the user whether their answer was correct or incorrect. The user will be allowed 3 tries at each problem. The program will also keep statistics on how many problems were answered correctly.

This week you will continue with the project by creating functions for Addition(), Subtraction(), Multiplication(), and Division() functions. In order to test the menu function completely we needed to write all of the functions. Adapt the Addition code you have already written, so it becomes the code in the Addition() function.

So now lets add the code for the remaining functions. Pay particular attention to the division function. You will want to do only integer division showing the answer and remainder back to the user. Prompt the user for both the answer and remainder for all division problems. Use the Modulus operator to calculate the correct answer and remainder. Also include logic to make the numerator the larger of the two numbers to avoid answers less than 1.

THIS IS THE CODE THAT I HAVE SO FAR. THIS IS THE CODE THE FUNCTIONS NEED TO BE ADDED TO.

#include

#include

#include

int Menu();

int Addition();

int Subtraction();

int Multiplication();

int Division();

main()

{ int option;

//srand(time(NULL));

option = Menu();

while(option != 5)

{

//switch(option)

//{ case 1:Addition();break;

//case 2:Subtraction();break;

//case 3:Multiplication();break;

//case 4:Division();break;

}

option = Menu();

//}

}

int Menu()

{ int option;

puts("Math Practice Program");

puts("1. Addition");

puts("2. Subtraction");

puts("3. Multiplication");

puts("4. Division");

puts("5. Quit");

printf("Enter an option ");

scanf("%d",&option);

add();

return 0;

}

int add()

{

int correctAnswer;

printf("35 + 15 = ?");

scanf("%d", &correctAnswer);

if (correctAnswer==50)

printf("Correct!");

else

printf("Incorrect.");

return;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

2. (1 point) Given AABC, tan A b b

Answered: 1 week ago