Problem 1.3

CIS 210 Home Page Last updated 2007/08/28 13:54:31

Problem 1.3 - Metric Conversion

In this program, you will write some code to convert a distance measurement in inches, feet, or miles to a metric equivalent. Since this is the first assignment and we have not covered much material yet, the program will be small and simple. Unlike the previous program, you are not provided with any code, but must start from scratch.

However, here's a hint about programming: all programs have some common aspects. It may save some typing and debugging to start with an existing, working program. Delete the irrelevant parts, change code that is close to what you need, and add new code. For this problem, after you read the requirements, you may feel that some of the previous programming problem would work here. At the very least, the header of the main method will be the same since it is the same in all Java programs.

Requirements

The conversion program should:

Examples

Your program should be called Metric. If we executed the program from a command prompt:
C:> java Metric
Enter a linear value to convert to metric: 1
1.0 inches is 2.54 centimeters
1.0 feet is 0.3048 meters
1.0 miles is 1.609344 kilometers
Here is another example:
Enter a linear value to convert to metric: 7.5
7.5 inches is 19.05 centimeters
7.5 feet is 2.286 meters
7.5 miles is 12.07008 kilometers
(The text in italics is what you type as input when prompted.)

Things to note

Coding Restrictions

What to turn in

Turn in your code for Metric.java.