COP3832, Spring 2001, Assignment 2
Due Wednesday 2/7 at the start of class.
To hand in the assignment, do the following
-
Hand in a printout of the source code for the hw2.html file.
-
Also, send me an e-mail message with the URL of your home page when the
assignment is ready to be graded.
-
Upload a copy of the hw2.html file using the
~downeyt/cs/public/webftp/webftp.pl program from mongoose.
It is imperative that you do not allow anyone else to have access to the
hw2.html file.
Please do this assignment on mongoose.aul.fiu.edu. If you cannot access
mongoose, then try weasel.aul.fiu.edu. Let me know if you do
not have access to mongoose.
Set up a web site on www.aul.fiu.edu
Create an HTML page on mongoose named hw2.html that is generated
dynamically using JavaScript. The page should do the following:
-
You may use global variables. Use functions to organize your code. You must
have at least these three functions: read the data; display the table;
display the average, min, and max.
-
Read an unspecified amount of integers from the user. Continue reading numbers
from the user until a negative integer is entered. The user must enter integers.
If a non-integer is entered, then alert the user that the last input was
ignored.
-
Display the count and average of all the numbers, rounded to two decimal
places.
-
Display the largest number and its location in the list of numbers that were
entered.
-
Display the smallest number and its location in the list of numbers that
were entered.
-
Do not sort the array at any time.
-
Display all the numbers that were entered in a table.
-
Do not include the terminating negative number.
-
The table should be square, that is it should have the same number of rows
as columns. Use the smallest square table possible to hold all the numbers
entered. It is possible that the last row of the table will have some (or
all) empty cells. Fill all empty cells with a *.
-
Change the background color for all numbers in the table that are above the
average. Use a style sheet to change the color.
-
Display all the numbers that equal the maximum in a large font. Use a style
sheet to change the font.
-
Display all the numbers that equal the minimum in a small font. Use a style
sheet to change the font.
-
You will need several styles for TD elements: normal, minimum,
maximum, above average, and maximum that is above average
Some useful functions from JavaScript
-
document.write(string)
-
document.writeln(string)
-
document.close( )
-
Math.round(number)
-
Math.ceil(number)
-
Math.floor(number)
-
Math.sqrt(number)