Program to display the original value

Assignment Help JAVA Programming
Reference no: EM13941672

Math.floor may be used to round a number to a specific decimal place. The statement

y = Math.floor( x * 10 + 0.5 ) / 10;

rounds x to the tenths position (i.e., the first position to the right of the decimal point).
The statement

y = Math.floor( x * 100 + 0.5 ) / 100;

rounds x to the hundredths position (i.e., the second position to the right of the decimal point). Write an application that defines four methods for rounding a number x in various ways:

a) roundToInteger( number )

b) roundToTenths( number )

c) roundToHundredths( number )

d) roundToThousandths( number )

For each value read, your program should display the original value, the number rounded to the nearest integer, the number rounded to the nearest tenth, the number rounded to the nearest hundredth and the number rounded to the nearest thousandth.

Reference no: EM13941672

Questions Cloud

Lines of reporting and accountability : Who will be represented (this might be a consumer group, the mental health or AOD industry or a particular community group) What the scope, scale and parameters of your role as representative will be and what lines of reporting and accountability w..
Discuss the differences between crimes and torts : Discuss the differences between crimes and torts. Include differences in sanctions, parties, and burdens of proof in your answer.
Who is the audience of the communication plan : What organization will you be creating the plan for? (Real is better, but authentic hypothetical is acceptable too.) What is your topic or event for the communication plan? Who is the audience of the communication plan
Explain how your perspectives developed on the policies used : Explain whether you are aligned more toward Becarria's position on crime or the stand of biosocial theorists. Explain whether your views about an individual's ability to make a free choice to commit crime changed.
Program to display the original value : For each value read, your program should display the original value, the number rounded to the nearest integer, the number rounded to the nearest tenth, the number rounded to the nearest hundredth and the number rounded to the nearest thousandth.
Provide the missing data in the following situations : Provide the missing data in the following situations:
Annual approximate interest costs not taking discount : How do you compute annual approximate interest costs not taking a discount what conclusion can be drawn from the calculations?
Different view on mcdonalds approach to rest breaks : A different view on McDonalds approach to Rest breaks, from the Union representing a changes to the law applying to rest breaks: http://www.parliament.nz/resource/0000116617 number of McDonald's workers: http://tvnz.co.nz/national-news/mcdonald-s-..
New clubs will require an increase in net working capital : McGilla Golf has decided to sell a new line of golf clubs. The length of this project is seven years. The company has spent $1460149 on research and development for the new clubs. The plant and equipment required will cost $28973884. The new clubs wi..

Reviews

Write a Review

 

JAVA Programming Questions & Answers

  Display random numbers to simulate rolling a die

1. Display random numbers to simulate rolling a die2. Create a java program that simulate a casino game. (rollin a die)

  Write a program that plays a word game with the user

Write a program that plays a word game with the user. The program should ask the user to enter the following.

  Implementing dijkstras shortest-path algorithm

Implementing Dijkstras shortest-path algorithm - To improve efficiency of the program, you should add some caching to it

  Run the code

Run the following code, Explain the output aYer you let it run 20 seconds, 5 minutes, 10 minutes.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Opening the file shows the output below

If the program runs successfully, the only message your program prints on screen is "Output file has been created: Unicode.dat' but opening the file shows the output below.

  Scanning and parsingimplement the lexical and syntactic

scanning and parsingimplement the lexical and syntactic analysis of minifun programming language. the scanner splits up

  Write a program that starts a player off with a bank of $15

Write a program that starts a player off with a bank of $15.00.

  Write java program that writes names to text file

Create an empty text file called myfile.txt. Write a Java program that writes your names to the text file created. If the file does not exist, include an exception handler for that error.

  Write a java class that creates an array of integers

Write a Java class that creates an array of integers, fills it with values, prints the unsorted values, sorts the values into ascending order, and finally prints the sorted values.

  Write a program to generate a data file named wi ndl. dat

Write a program to generate a data file named wi ndl. dat

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