Write a program that reads in two floating-point numbers and

Assignment Help Basic Computer Science
Reference no: EM13234927

Write a program that reads in two floating-point numbers and tests whether they are the same up to two decimal places. here are two sample runs. Enter two floating-point numbers: 2.0 1.99998 They are the same up to two decimal palces. Enter two floating-point numbers: 2.0 1.98999 They are different. import java.util.Scanner; class FloatingPoint { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter two floating-point numbers: "); double x = sc.nextDouble(); double y = sc.nextDouble(); if (x== y) System.out.println("They are the same up to two decimal places."); else System.out.println("They are different"); } } This is the code I have come up with so far which i know is incorrect. I need help writing the code that checks these numbers up to two decimal places to see if they are the same or different.

Reference no: EM13234927

Questions Cloud

Which dim statement would correctly declare an array : Which Dim statement would correctly declare an array of this structure for elements having subscripts from 0 through 30
What is the marginal cost of producing 2 units of output : An accountant for a car rental company was recently asked to report the firm's costs of producing various levels of output. The accountant knows that the most recent estimate available of the firm's cost function is, C(Q)=100+10Q+Q^2
What is the magnitude of its velocity : A flight controller determines that an airplane is 30.0mi south of him, Half an hour later the same plane is 30.0mi north west of him, What is the magnitude of its velocity during this time
Calculate the marginal product of labor when 9units utilised : The manager of a national retailing outlet recently hired an economist to estimate the firm's production function. Based on the economist's report, the manager now knows that the firm's production function is given by Q=K^(1/2) L^(1/2)
Write a program that reads in two floating-point numbers and : Write a program that reads in two floating-point numbers and tests whether they are the same up to two decimal places. here are two sample runs.
What is constitutional protection against double jeopardy : What is Constitutional protection against double jeopardy?
What constitutional amendment are they derived from : What are your Miranda Rights and what Constitutional Amendment are they derived from? When do they apply?
Find what is the marginal product of capital and labor : The manager of a meat-packing plant can use either butchers (labor) or meat saws (capital) to prepare packages of sirloin steak. Based on estimates provided by an efficiency expert, the firm's production function for sirloin steak is given by Q=K+..
Describe the constitutional protection against unreasonable : Describe the Constitutional protection against unreasonable search and Discuss the Federal antiterrorism Act briefly.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Describe factors having greater trust in e-business

Describe the factors which would contribute to you having greater trust in e-business. Do you look for trust seals when shopping online?

  Explain security awareness and training document

Amy walked into her office cubicle and sat down. The entire episode with the blond man had taken well over two hours of her day. Based on this case study, what security awareness and training documents and posters had an impact in this event?

  Actions-hard disk crash and all data backed up are lost

You come to work on a Monday morning and find that the office computer is not working. The system manager informs everyone that the computer's hard disk crashed and that all datat that wer not backed up are lost. What do you do?

  Wireless technology to benefit related working environment

Explain how airlines, construction industry, the medical field, and education use wireless technology to benefit related working environments?

  The sum of the first even integers true or false

The sum of the first 17 even integers is 306. True or False Answer

  Decimal digit in bcd

Design a combinational circuit with four input lines that represent a decimal digit in BCD and four output lines that generate the 9's complement of the input digit.

  Assume the friction coefficient between the rope and capstan

How many wraps around the capstan are required such that one person exerting 100lbs of force can keep the ship at its mooring. Assume the friction coefficient between the rope and capstan is 0.2.

  Write a program that reads in an integer value

Write a program that reads in an integer value for n and then sums the integers from n to 2*n if n is nonnegative, or from 2*n to n if n is negative. Write the code in two versions: one using only for loops and the other using only while loops.

  Prepare design proposal for new office network

Callingyou Inc is a growing company providing 24-7 telephone support services for numerous companies. They have asked you to prepare a design proposal for their new office network.

  Create a short text-based adventure game

In this assignment you will create a short text-based adventure game. The user is presented with a short text description of the state of the game and a small set of alternative actions to take.

  How frequently should run maintenance on equipment

With one network operating system (NOS) running on routers and switches, there can be elimination of third party vendors which service. So actually how frequently would they require to run maintenance on their equipment?

  Characterize a page fault rate using pure demand paging

Consider system which uses pure demand paging: When a process first start execution, how would you characterize a page fault rate?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd