Answered step by step
Verified Expert Solution
Link Copied!

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):
image text in transcribed
Create a simple calculator. The program should ask the user to: Lenter 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 it, 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 3314.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

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

Database Concepts

Authors: David M. Kroenke

1st Edition

0130086509, 978-0130086501

More Books

Students also viewed these Databases questions

Question

Discuss the key ambient conditions and their effects on customers.

Answered: 1 week ago

Question

Understand the roles of signs, symbols, and artifacts.

Answered: 1 week ago