Question: task of a simple calculator. The program should ask the user for which of the 4 operations they want to perform ( + , -

task of a simple calculator. The program should ask the user for which of the 4 operations they want to perform ( + , - , * , / ) followed by the data for number1 and number2. Your program will check if the user data is correct and will perform the appropriate operation and print the result to the screen preceded by the data and the operation. End the program with a thank you message. Make sure to detect divide by zero error and print its an error Make sure the user entered the correct operations +, -, * or /, if not print an error. You can assume user will enter numbers for number1 and number2, so no error checking is needed.

Example: Enter the operation you want to perform (+, -, *, /): / Enter the first number: 2 Enter the second number: 3

Result 2.0 / 3.0 = 0.6666666666666666 Thank you for using simple calculator

Example Enter the operation you want to perform (+, -, *, /): plus Enter the first number: 5 Enter the second number: 7

Result Error: invalid operation Thank you for using simple calculator

Example Enter the operation you want to perform (+, -, *, /): / Enter the first number: 5 Enter the second number: 0

Result Error: division by zero Thank you for using simple calculator

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!