Create a web page called to help people with conversions from English measurements to Metric. When loaded, the page will allow the user to select one of three conversion types: Fahrenheit to Celsius temperatures, Miles to Kilometers, or Ounces to Grams. A starter html page has been provided with the assignment, which appears as follows:
Build your application in netbeans as a simple HTML type project; the following features should be present:
· Use a JavaScript file called convert.js to store the conversion functions. Each function should accept the English measurement value and return the metric result
· On the result values, round to 3 decimal positions (not shown in the example below)
· Perform data validation as discussed below
The conversion functions are:
· The formula for F-to-C conversion is: Celsius = (Fahrenheit – 32) * 5/9
· The formula for Miles to Kilometers: Kilometers = Miles * 1.6
· The formula for Ounces to Grams: Grams = ounces * 28.35
The screen calls the appropriate conversion function based on an ‘on click’ event for the convert button shown above. As noted, all JavaScript code functions should be put in the convert.js file. In addition, the program should do the following:
· Check that a value has been entered in the input text area; if it has not, produce an ‘alert’ popup stating that the box is empty or the value is illegal
· Add an additional data validation function so that zero or negative values are not accepted for miles or ounces conversions, and a number at or below -459.67 Fahrenheit is rejected (i.e., absolute zero or below).
· Use radio buttons (as shown) to indicate which conversion is desired (this will require you to examine the value of the selection group inside the JavaScript in order to call the correct function)
· Clear the text boxes and return the cursor to the input text box when the clear button is clicked; reset the radio buttons to default.
· Build and display an output string similar to the example shown (which repeats the selected English value along with the metric name).
Part A: conversion of F to C temperatures
Part B: the remaining two conversion processes
Some sample runs:
Extra Credit (5 pts)
Add a new conversion function that does the reverse for temperatures: i.e., converts Celsius back to Fahrenheit. You do not need to adjust headings or user instructions, but your page should still validate input so that Celsius values below absolute zero are rejected with an error pop-up.