Homework 2

 

Suggested Layouts are on the HW2Layouts.htm page.

Metric Conversion (50PTS)  1. You need to develop a MetricConversion.html page that has a single textbox for an input with three radio buttons that tell the units.  You also need one textbox for output.  The radio buttons should have labels of

  • feet
  • yards
  • miles

You need to write some JavaScript to determine which of these radio buttons is selected and convert the inputted value to meters accordingly.  Write this solution into the output textbox.

Make sure to make the form lets the user know what you want them to do.

If they make an input error you want to give them an alert( ).

A Simple Calculator (50 PTS)  2.  You need to develop an Calculator.html page.  You want two input text boxes labeled first number and second number.  You need two output text boxes.  One labeled result, the other labeled operation.  You want four command buttons, one each for addition, subtraction, multiplication, and division.

You want the program to check that both textboxes have numeric entries when a button is pressed.  You want to give the user an appropriate alert( ) if they've not properly entered the inputs.  You need to display the result in the result textbox, but also display which operation was performed in the operation textbox.