Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 19 21 2012 Proceedings Part 3 Lnai 7198

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284922, 978-3642284922

More Books

Students also viewed these Databases questions

Question

Write an expression for half-life and explain it with a diagram.

Answered: 1 week ago

Question

What do you mean by underwriting of shares ?

Answered: 1 week ago

Question

Define "Rights Issue".

Answered: 1 week ago

Question

Discuss the Rights issue procedure in detail.

Answered: 1 week ago