Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

write a java program 3. Create the equivalent of a four -function calculator. The program should request the user to enter a number, an operator,

write a java program
image text in transcribed
3. Create the equivalent of a four -function calculator. The program should request the user to enter a number, an operator, and another number (Use floating-point numbers). It should then carry out the specific arithmetic operation: addition, subtraction, multiplication or division of two numbers. As you know, division by zero is not defined. So program must display an error message if division by zero occurs. You may use a switch statement to select the operation. Finally display the result. When it finishes the calculation, the program should ask if the user wants to do another calculation. The answer can be y' or n' (may use uppercase y or n also). The following output shows the results of two operations Enter first number: 15 Enter an operator: / Enter second number: 2 15/2-7.50 Do another (Enter y or Y for yes or n or N for no)? y Enter first number: 12 Enter an operator: + Enter second number: 125 12 125 137 Do another (Enter y or Y for yes or n or N for no)? 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_2

Step: 3

blur-text-image_3

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

Oracle 11G SQL

Authors: Joan Casteel

2nd Edition

1133947360, 978-1133947363

More Books

Students explore these related Databases questions