Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a simple calculator. The program should ask the user to: i. enter an even round number limited between [10 30] (eg:12/14/20/38) for first input
Create a simple calculator. The program should ask the user to:
i. enter an even round number limited between [10 30] (eg:12/14/20/38) for first input value.
ii. an operator which is limited to plus and minus only.
iii. and another even round number as in i) for second input value.
It should then carry out the specified arithmetical operation: adding, subtracting, multiplying, or dividing the two input values. Use a switch statement to select the operation. Finally, display the result. When it finishes the calculation, the program should ask whether the user wants to do another calculation. The response can be Y or N.
However, please practice error control. For an example if the user inserts a character/symbols or any number not within range including odd number (eg: 33/-4,m/@) as well as wrong operator (multiply and divide) as inputs, the program will prompt such warning:
Wrong inputs. Please insert a proper input.
Please also display a clear instruction for user to avoid wrong inputs.
Output Example:
You have inserted 30 as first input, and 48 as second input. The result of addition between input is 78.
Do you want to do another calculation? (Y/N):
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