Write a program to be used as a math tutor

Assignment Help C/C++ Programming
Reference no: EM131117430

Question 1

Write a program to be used as a math tutor for a young student. The program should display a menu allowing the user to select addition, subtraction, multiplication or division. The final selection on the menu should allow the user to quit and exit the program. Each of modules, Addition, Subtraction, Multiplication and Division should be separate functions called from Main.

1. Display the menu-Accept user input on the operation to be performed

2. Generate 2 random numbers from 1-20 - Pass the random numbers to each function as arguments.

3. If user selects division, ensure the divisor is not zero.

4. Display the numbers and accept the users answers from the keyboard on whether they perform addition, subtraction, multiplication or division

5. Compute the correct answer with your program. Compare the users answer to the answer you calculated in your program.

6. If the user enters the correct answer, display the message
Congratulations..You are Correct

7. If the user enters the incorrect answer, display the message
Incorrect..The correct answer is...
display the correct answer.

8. The program should display the menu again, until the user ends the program by choosing to quit

------------------------------------------------------------------------------------------------------------------------------------
- ***must include a header file and prototype file ( example function addit/devideit etc etc)***
- must loop while and/or do while will work but they need to be able to go from division to addition etc etc and so forth
- if you use need vector use array instead
- the answers will be output on the screen not a separate file
- please be willing to make changes to the code as to either correct errors or if anything used wasnt learned
- any further questions please feel free to ask
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
incomplete and error filled answer given
------------------------------------
#include //Header Declaration
#include
#include //Used for a better random number generator
#include //Used for a better random number generator
using namespace std;

int ans1, num1, num2; // declare num1 and num2
int choice; // variable choice

void mainmenu(); // Main menu
void addition(int rand1, int rand2); // addition function
void subtraction(int rand1, int rand2); // subtraction function
void multiplication(int rand1, int rand2); // multiplication function
void division(int rand1, int rand2); // division function
bool start = true; // start

int main()
{
if (start = true)
mainmenu ();
else if (start = false);
system("pause");
return 0;
}
void addition(int rand1, int rand2) // perform addition.
{
/* Initialize some var's and set equal to our passed values */
int random1 = rand1;
int random2 = rand2;

cout
cin >> ans1;

cout
if( ans1 == ( random1 + random2 ) )
{
cout }
else
{
cout }

mainmenu();
}
void subtraction(int rand1, int rand2) //do subraction function.
{
/* Initialize some var's and set equal to our passed values */
int random1 = rand1;
int random2 = rand2;

cout
cin >> ans1;

cout
if( ans1 == ( random1 - random2 ) )
{
cout }
else
{
cout }

mainmenu();
}
void multiplication(int rand1, int rand2) //do multiplication function.
{
/* Initialize some var's and set equal to our passed values */
int random1 = rand1;
int random2 = rand2;

cout
cin >> ans1;

cout
if( ans1 == ( random1 * random2 ) )
{
cout }
else
{
cout }

mainmenu();
}
void division(int rand1, int rand2) // do division function.
{
/* Initialize some var's and set equal to our passed values */
int random1 = rand1;
int random2 = rand2;

cout
cin >> ans1;

cout
if( ans1 == ( random1 / random2 ) )
{
cout }
else
{
cout }

mainmenu();
}
void mainmenu()
{

/* Advamced Random Number Generation (Better-Results) */
int random1, random2;
time_t seconds; /* Declare variable to hold seconds on clock. */
time( &seconds ); /* Get value from system clock and place in seconds variable. */
srand( ( unsigned int ) seconds ); /* Convert seconds to a unsigned integer. */

random1 = rand() % (20 - 1 + 1) + 1;
random2 = rand() % (20 - 1 + 1) + 1;


/* Standard Random Number Generation (Ok-Results) */
//int random1 = rand() % 20+1; // Random number will start at 0 so add one
//int random2 = rand() % 20+1; // Random number will start at 0 so add one

cout cout
/*main menu options */
cout cout cout cout cout
cin >> choice; //ask user to enter selection, places it in int choice

switch (choice)
{
case 1: addition(random1, random2);
break;
case 2: subtraction(random1, random2);
break;
case 3: multiplication(random1, random2);
break;
case 4: division(random1, random2);
break;
case 5:
(start = false);
int main(); cout break;
default:
cout cin.clear();
cin.sync();
mainmenu();

Question 2

During winter when it is very cold, typically, everyone would like to know the windchill factor, especially, before going out. Meteorologists use the following formula to compute the windchill factor, W:

https://i.imgur.com/LbWONlb.png (img link to forumla )

where V is the wind speed in miles per hour and T is the temperature in degrees Fahrenheit. Write a program that prompts the user to input the wind speed, in miles per hour, and the temperature in degrees Fahrenheit.

The program then outputs the windchill factor. Your program must contain at least two functions: one to get the user input and the other to determine the windchill factor.

Reference no: EM131117430

Questions Cloud

The key points-facts presented in the article : Access the GCU Library and select an article that deals with one of the following topics: marketing concept, marketing orientation, market segments, or marketing mix. In a paper of 500-750 words, summarize the article, addressing the following qu..
Implementation of the fibonacci sequences : Provide the c++ implementation of the Fibonacci sequences. Please give the two approaches to the problem
The following regarding a certified public accountant : All of the following regarding a Certified Public Accountant are true except:Must meet education and experience requirements.Must pass an examination.Must exhibit ethical character.May also be a Certified Management Accountant.Cannot hold any cer..
Explain restriction place on state and local government debt : Based on the e-Activities, assess and explain the restrictions placed on state and local government debt in your state. Provide examples to support your answer.
Write a program to be used as a math tutor : Display the menu-Accept user input on the operation to be performed - Display the numbers and accept the users answers from the keyboard on whether they perform addition, subtraction, multiplication or division
Human resource management : You are to work alone on the midterm without any help from anyone. Plagiarism, cheating, and academic dishonesty in any form will result in a grade of F for the course!
Draw a component block diagram : Draw a component block diagram for each of the following feedback control systems.
How can persistently weak currencies be stabilized : How Can Persistently Weak Currencies Be Stabilized. Who Is Correct? Use the Internet to learn more about this issue. Which argument do you support? Offer your own opinion on this issue.
Discuss challenge that you believe the public will encounter : Discuss the major challenges that you believe the public will encounter as a result of the proposed budget. Justify your answer with examples.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd