Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem Description Skills required for this program: Java Math Library, operators, and printf In this assignment you will be writing a program to calculate a

Problem Description
Skills required for this program: Java Math Library, operators, and printf
In this assignment you will be writing a program to calculate a series of simple mathematical operations on two variables, x and y. You will be creating a class named Program4. First, read in the value of x. Next, read in the value of y. Both are doubles such that )x,y(1000.0. The input numbers are on individual lines.
The output will be the result of the following calculations, each expressed as floating point numbers rounded to 4 decimal places and each terminating in a new line:
x+y
x-y
xy
xy
xy
You can do this using printf. For example the line System.out.printf("%.2f
",4.85579); would print 4.86 the number literal rounded to two decimal places followed by a new line.
Sample Test Cases
You can test your program by copying an entire input sample and pasting it into the console. If the output does not exactly match the example output, there is an error in your code.
The input for this program will be two double numbers on two lines. The numbers will be positive.
\table[[Input,Output],[,2.0000],[,0.0000],[1.0,1.0000],[1.0,1.0000],[,1.0000]]
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

Learn To Program Databases With Visual Basic 6

Authors: John Smiley

1st Edition

1902745035, 978-1902745039

More Books

Students also viewed these Databases questions