CSD 340: The Week beginning Jan. 31
Have you entered the
Digital
Found Objects competition yet?
Coming attractions: We are going to write a script that produces a page inspired by
Jiri Kolar
(see for example Creation/Venus). To prepare
take two images and slice them up into an equal number of slices. Let's
all choose 16 slices and name them systematically. I had names like
VenusSlice1.jpg, VenusSlice2.jpg, etc. and CreationSlice1.jpg,
CreationSlice2.jpg, etc.) Do not use a copyrighted image; either choose
a old image or one of your own.
- Reading:
Chapter 3 in Beginning JavaScript
- Homework:
- The first roll of craps. The game of craps consists of rolling two
dice. On the first roll, if the sum of the two dice is 7 or 11, then the player
wins. If the sum of the two dice is 2 (snake eyes), 3 or 12 (box cars), then the
player loses. Any other sum is known as the point, and the game requires more
rolls.
- You will probably want to use the following line of code
diceThrow = (Math.floor(Math.random() * 6) + 1);
from p. 126 of Beginning JavaScript (Paul Wilton).
- You should display the images of the two dice that are rolled (you can use
Die1.gif, Die2.gif,
Die3.gif, Die4.gif,
Die5.gif, Die6.gif)
- Display a message that displays the sum of the dice, whether the player
won, lost or should roll again.
- Create images for "snakes eyes" and "box cars" that display when
appropriate.
Due Feb. 7
Monday:
- Write a page that prompts a user to enter the number of credits he or she has
earned so far. The program should determine and display his or her class:
freshman 1-23 credits, sophomore 24-53 credits, junior 54-83 credits or senior 84
credits and up.
- Write a page that prompts the user to enter the hourly wage and number of hour
worked for an employee. The script should calculate the weekly salary of the
employee and display the result. If the hourly wage is below Minimum Wage (let's
use $5.25), an alert box should appear indicating the problem. If the employee worked
more than 40 hours, he or she should receive time and a half for the hours exceeding
40. For example if one works 36 hours at $6.00 an hour, one will receive
216 = 36*6 dollars; but if one works 44 hours at $6.00 an hour, one will receive
276 = 40*6 + (44-40)*6*1.5 dollars.
Wednesday:
Introducing For Loops
uses
LoopIntro.htm and
LoopTable.htm.
Friday:
Loop Lab. It might come in handy to have a
A simple template for starting HTML files