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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started