Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi I need some help figuring this project out. It is for C Programming only. Can you please give me the entire code for this

Hi I need some help figuring this project out. It is for C Programming only. Can you please give me the entire code for this project. Thank you.

In this lab we will build a calculator that can perform different mathematical operations as wellas can check for valid inputs and display the results in a formatted manner. Your task is to write a program that does all of the following: 1. Displays the menu and asks user to enter a choice from the menu.2. If the user enters something other than the right choices asks again for a valid choice.3. Reads two numbers from the user. You should use type float or double for the numbers.4. If the user enters wrong input, asks for the correct input again.5. If the user choses division then the second number cannot be zero. In that case, the

program should ask user for the input again.6. Then displays the result in the form of mathematical equation.7. Keeps displaying the menu and perform the tasks until the user decides to quit.

Sample input/output [The letters in bold are user inputs]:

Enter the operation of your choice:(a) Add(s) Subtract(m) Multiply(d) Divide(q) Quit

b b is not a correct choice.Please respond with a, s, m, d or q: aEnter first number: 22.4Enter second number: twotwo is not a number.Please enter a number, such as 2.5, -1.78E8 or 3: 122.40 + 1.00 = 23.40Enter the operation of your choice:(a) Add(s) Subtract(m) Multiply(d) Divide(q) Quit

d Enter first number: 99.36Enter second number: 0Enter a number other than 0: .399.36 / 0.30 = 331.20Enter the operation of your choice:(a) Add(s) Subtract(m) Multiply(d) Divide(q) Quit

q Bye!

IMPORTANT GUIDELINES

1) The output of your program should match exactly the format in the above sampleinput/output, including the alignment and spaces.2) Display up to two decimal places and correct mathematical operators (* formultiplication, - for subtraction etc.) for each operation.

3) Note that, when an incorrect option or number is entered you need to display the erroneousinput too and ask user to enter again.

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