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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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