Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a program that asks the user for two real numbers, a and b . Then present a choice of the f basic arithmetic operators

Create a program that asks the user for two real numbers, a and b. Then present a choice of the f
basic arithmetic operators from a menu, addition, subtraction, multiplication, and division.
Prompt the use to enter in a choice. If they select an invalid choice, tell them they selected an inva
choice and exit the program.
Additionally if they select division, check if b is zero. If so, say that they are not allowed to divi
by 0 and close to program.
Your Program should output something similar to the sample outputs given below.
Your grade will be based on good programming technique (comments, variable names, assumptio
etc.), correct outputs (correct mathematical computations), and correct program output (good us
interface/explanations.)
As part of your upload include your java file and a picture of the programming being run on yc
machine (a screen capture (like the examples given) is fine.)
C: \Java>java CSCI1301ProgramHW7
Welcome to the single operation calculator.
Enter in your first number: 2.5
Enter in your second number: -1.3
You entered the numbers 2.5 and -1.3.
Pick an operation from the menu:
Compute the sum.
Compute the difference.
Compute the product.
Compute the quotient.
Your choice is: 1
The sum of your two numbers is 1.2.
C: \Java>java CSCI1301ProgramHW7
Welcome to the single operation calculator.
Enter in your first number: 17.0
Enter in your second number:
You entered the numbers 17.0 and 0.0.
Pick an operation from the menu:
Compute the sum.
Compute the difference.
Compute the product.
Compute the quotient.
Your choice is: 4
You are not allowed to divide by .
Closing the program.
image text in transcribed

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 Systems An Application Oriented Approach Complete Version

Authors: Michael Kifer, Arthur Bernstein, Richard Lewis

2nd Edition

0321268458, 978-0321268457

More Books

Students also viewed these Databases questions