Problem Set 6
Fall 2008
Due: Beginning of class, Wednesday, 15 October.
Reference: Gosselin, Chapters 2-4.
Slides on Javascript
You have been hired to create an auction web page for raising money for the
Always Current School (ACS).
The specifications are as follows.
- You must have a header and footer on your page. Design will be graded.
- You must list 5 items for auction. Each line must contain the following
information about an item:
- The name of the item (you may make this up).
- A picture of the item (you may get this from anywhere).
- The current highest bid for that item (you can use a text box
for this, but it must be read only).
- The number of the highest bidder for that item (you can use a text box
for this, but it must be read only).
- A text box for a bidder to enter in a new bid.
- A text box to accept the bidder's number.
- A button to "bid".
When a bidder enters in new bids for one or more items and clicks the "bid"
button, your program must do the following:
- Obtain the bid for each item.
- Determine if the bid for the item is higher than the current highest bid. If
not, put up a new browser window dialog telling the bidder that her bid is rejected and why.
This window must be an appropriate size
(i.e., you must set the size to just encompass your message) and must not have
any scroll bars, tool bars, etc.
- Determine whether the current bidder is also the high bidder on the item.
If she/he is, then she/he cannot bid again until someone else bid's higher.
Again, if the bid is not accepted, put up a new browser window telling the bidder
that she is already the highest bidder. This window must be an appropriate size
(i.e., you must set the size to just encompass your message) and must not have
any scroll bars, tool bars, etc.
- Make sure that a bid is no more than 10% higher than the current highest bid.
If not, you may either make the bid exactly 10% higher or you may put up a new
browser window
telling the bidder that their bid is too high (and by how much). This window
must be an appropriate size
(i.e., you must set the size to just encompass your message) and must not have
any scroll bars, tool bars, etc.
- do this for every item that the bidder has bid on (note that the bidder
may bid on 0 to 5 items).
To keep track of this information you'll need some variables.
- Keep the highest bids in an array.
- Keep the corresponding bidder number in a parallel array.
The logic of your javaScript program should be as follows.
- When a bid is submitted, check the correct element in the highest bid array
to see if the new bid is higher.
- If it is higher, check the bidder array to ensure that the bidder is someone
new.
- If both of these are true, then update the highest bid array and the
corresponding highest bidder array.
You must perform the following tasks to complete this assignment:
- Create a directory on your icsun account named "problemSet6" and store all of
your html files in this directory.
- Your page must work correctly in a standards-based browser like Safari or FireFox. Basically, this means any browser
other than Internet Explorer. IE often accepts invalid code or nonstandard code. I will not use IE when I test your
page.
-
Hand in a printed copy of the html code
of all pages.
You must have your name and the assignment number
on every web page that you turn in. You must give the URL of the main
page of your site on the first page of the HTML code that you turn in.