Java Notes
Programming: Numeric Conversion
Name ________________________________
Description
Write a program which converts a measurement from one system of units to another. Read a number (or numbers) in one system and output the equivalent number (or numbers) in the other system. Instead of thinking of it as a conversion, it could also be a calculation, eg, to calculate the air pressure from the altitude.
Model program and iterative programming
Start with Kilometers to Miles as an example of how a conversion program might be written.
Iterative programming is the process of writing some of the program, compiling and testing it, then writing more, compiling and testing that, etc. Keep going in this cycle until the program is done. The iterative style generally has a much higher success rate than writing the entire program, then compiling and testing it. You may also have to make greater changes to it, eg to read two values, one for feet and one for inches.
Change names. You're welcome to start with the Kilometers to Miles program, but be sure you change all names and comments to reflect the problem you are solving.
Examples of other possible conversions/calculations
- Fahrenheit - Celsius
- Pounds - kilograms
- Feet and inches - meters
- Inches - lightyears
- Seconds - Days, hours, minutes, seconds
- Cubic meters - acre feet
- Miles per hour - Mach
- Room length, width, and height to gallons of paint.
- Anything else! I would prefer that you choose something that you would really like to see converted, but avoid conversions that aren't fixed, eg, dollars to Euros.
















Current Comments
0 comments so far (post your own) View All Comments Latest 10 Comments: