HOMEWORK 2 - Basic Operations
Part 1 Create a webpage that contains a script that displays, as XHTML text, the numbers 1 to 4 on the same line, with each pair of adjacent numbers separated by one space. Write the script using the following methods:
a. Using one document.writeln statement and font color of blue for the text.
b. Using 4 or 5 document.write statements and font color of red for the text.
Part 2 Create a webpage that contains a script that inputs three integers via prompts or form text boxes and displays the sum, average, product, and the smallest and largest of the integers. Your results should be displayed using alerts or a form textarea.
Part 3 Create a webpage that contains a script that inputs 5 numbers and determines and displays the number of negative numbers, the number of positive numbers, and the number of zeros. For input, use either prompts or form text boxes. Your results should be displayed using alerts or a form textarea.
Part 4 Create a webpage that contains a script that calculates the squares and cubes of the numbers 1 to 6 and outputs XHTML text that displays (using document.write or document.writeln statements) the resulting values in a table format.
Extra Credit Create a webpage containing a script that will input an amount in U.S. dollars and display in a table its equivalent in each of five foreign currencies, rounded to 2 decimal places.

HOME