CIT041J Index > Forms Exercise

CIT041J - Forms Exercise

Read everything before doing anything.

Write functions that will activate the form shown below. It will convert from English to Metric and and vice versa.

EnglishMetricConversion

Use the “view source” option in your browser to get the source of the base file that you should use for your solution.

The conversion should “follow" the last field where you entered a number. Example:

  1. Type 212 in the English area.
  2. Select Fahrenheit <- -> Celsius from the drop-down menu.
  3. The number 100 appears in the Metric area.
  4. Select pounds <- -> kilograms from the drop-down menu.
  5. Because the last typing was in the English area, the Metric area changes to 96.1632.
  6. Type 100 in the Metric area. Since this is the most recent change, the corresponding number of pounds (220.46) appears in the English area.

Plan before you write! Do not sit down at the keyboard and start writing this code; it is not trivial. Write a flowchart or pseudo-code before you attempt this program. Remember: Programs written at the keyboard look like it.

Hints

  • You may want to make separate functions for metric-to-english and english-to-metric calculation.