Conversion Calculator

Overview:

Your job is to complete a conversion calculator program. The calculator converts between kilometers and miles, kilograms and pounds, celcius and farenheit, and liters and gallons. Most of the work is done for you. You just need to complete the methods that do the converstions.

 

Try the example (directions below): Conversion Calculator Applet

How to use the Calculator (The examle shows how to convert 100 lbs to kg):

  1. Type in a number (ex. 100)
  2. Click the button for the units that you have (ex. click the "lb" button)
  3. Click the button for the units you want to convert to (ex. click the "kg" button)
  4. The new number is your answer (ex. 45.36 is displayed)
  5. Click on the "clear" button to start over.

 

What you need to do:

  1. Download the following files if you don't have them: ConversionApplication.java, ConversionCalculator.java, ConversionPanel.java
  2. Open ConversionCalculator.java and fill in the methods so that they do the conversions
  3. To test your work, you need to open ConversionApplication.java. You need to compile and run from this file because it has the code for the window.
  4. Test your answers (see below).

Test Cases:

  1. 75 mi = 120.675 km
  2. 42 km = 26.098799999999997 mi
  3. 100 lb = 45.36 kg
  4. 10 kg = 22.05 lbs
  5. 68 F = 20 C
  6. 25 C = 77 F
  7. 2 L = 0.5284 gal
  8. 10 gal = 37.85 L