Question

Using Java, given a number which is the measurement of a distance in millimeter, change the...

Using Java, given a number which is the measurement of a distance in millimeter, change the representation of this number to the format of: x meters y centimeters and z millimeters. For example, if the number is 12345 millimeters, display the message: “12345 millimeters = 12 meters 34 centimeters and 5 millimeters”.

Homework Answers

Answer #1
import java.util.Scanner;

public class MillimetersToMetersCM {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int millimeters, meters, centimeters, n;

        System.out.print("Enter number of millimeters: ");
        millimeters = scan.nextInt();

        n = millimeters;

        meters = millimeters/1000;

        millimeters = millimeters % 1000;

        centimeters = millimeters / 10;

        millimeters = millimeters % 10;

        System.out.println(n+" millimeters = "+meters+" meters "+centimeters+" centimeters and "+millimeters+" millimeters");
    }
}

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Using Java, given 2 numbers which are the measurement of a distance in feet and inches,...
Using Java, given 2 numbers which are the measurement of a distance in feet and inches, for example 3 feet 7 inches. Change the measurement to meters and centimeters, and display message “? feet ? inches = ? meters and ? centimeters”. The ? should be replaced by real numbers. (1 inch = 2.54 centimeter, 1 foot = 12 inches)
3. The following is the formula to convert a Celsius degree to Fahrenheit degree: Fahrenheit =...
3. The following is the formula to convert a Celsius degree to Fahrenheit degree: Fahrenheit = (9/5) Celsius + 32 Write a program to prompt user to enter a Celsius degree, convert it to Fahrenheit and display Given an integer value which is the measurement of weight in ounce. Convert it to the format of: x pounds and y ounces. For example, if the given number is 100 ounces, it will be represented as 6 pounds and 4 ounces after...
In Java. Write a program that reads-in a times table-number. The program, using this table-number will...
In Java. Write a program that reads-in a times table-number. The program, using this table-number will produce the following report (as shown). The first item in the report is a number with starting value 1. Second column is the word “ X ” (representing the times symbol). Third column is the table-number (itself). Following is an equal sign “ = “ (representing a result). Last column is the result of the operation for that line or row which is the...
Using Java. The distance a vehicle travels can be calculated as follows: Distance = Speed *...
Using Java. The distance a vehicle travels can be calculated as follows: Distance = Speed * Time For example, if a train travels 40 miles-per-hour for three hours, the distance traveled is 120 miles. Write a program that asks for the speed of a vehicle (in miles-per-hour) and the number of hours it has traveled. Both values are assumed to be integers. It should use a loop to display the distance a vehicle has traveled for each hour of a...
Write a java program to display a given range of integer numbers (0 to 9) in...
Write a java program to display a given range of integer numbers (0 to 9) in the following order: Example : given (5 to 9), the program displays 56789 67895 78956 89567 95678 The first line displays the min to max range. Each line that follows should display the next higher number except when it hits the maximum number. In that situation, the line wraps back to the minimum sequence. For this problem write a static method to do the...
In JAVA the question will change as the quiz goes on (You don't have to do...
In JAVA the question will change as the quiz goes on (You don't have to do the whole project I just need help with the bolded portion of the question) Design an interactive multiple-choice quiz app on your choice of subject. Your quiz must consist of at least 10 questions. You must have to use nested layouts and customize the buttons used in your app. The app must also display the user’s progress throughout the quiz, showing the question number...
1) How many significant figure are in the number 0.00150? Group of answer Choices: 5 2...
1) How many significant figure are in the number 0.00150? Group of answer Choices: 5 2 3 4 2) If the calculation 12.1202 - 0.10 is performed, what is the answer to the correct number of significant figures? Group of answer choices: 12.0202 12.02 12 12.0 3) Which measurement does not represent the same length as the others? Group of answer choices: 0.01 kilometers 10 meters 1000 centimeters 100 millimeters 4) Lead has a density of 11.34 g/cm3. If one...
Java please. Given a sequence of unsorted numbers, determine how badly out of order they are....
Java please. Given a sequence of unsorted numbers, determine how badly out of order they are. Write a program that, for any given sequence of unique natural numbers, will compute the 'distance' between that original ordering and the same set of numbers sorted in ascending order. The distance should be computed by calculating how far displaced each number is in the original ordering from its correct location in the sorted list and summing those results. For instance, given the list...
The temperature at a point (x, y, z) is given by T(x, y, z) = 400e−x2...
The temperature at a point (x, y, z) is given by T(x, y, z) = 400e−x2 − 5y2 − 9z2 where T is measured in °C and x, y, z in meters. (a) Find the rate of change of temperature at the point P(2, −1, 2) in the direction towards the point (3, −5, 6). °C/m (b) In which direction does the temperature increase fastest at P? (c) Find the maximum rate of increase at P.
The temperature at a point (x, y, z) is given by T(x, y, z) = 100e^(−x^2...
The temperature at a point (x, y, z) is given by T(x, y, z) = 100e^(−x^2 − 3y^2 − 9z^2) where T is measured in °C and x, y, z in meters. (a) Find the rate of change of temperature at the point P(2, −1, 2) in the direction towards the point (5, −2, 3). (b) In which direction does the temperature increase fastest at P? (c) Find the maximum rate of increase at P.