CSD 340: The Week beginning Mar. 19 |
Write a program that uses a loop to calculate a factorial of a number from a drop-down select. It should also display the way the calculation was done. See example in figure below.
Write a program that adds an image element (mine was of a rabbit) to a page using a timer loop (mine was every half second). It would be fun if it played a sound each time a new picture was added.
Loop Practice: Write a progra that produces a straight-line depreciation schedule. The user would enter the initial value of the item, the "salvage value" -- the presumed value of the item after it has been used a number of years, and the lifetime -- the expected number of years the item will be used. The program then takes the difference between the initial and salvage values and divides that by the lifetime to produce the amount the item is depreciated each year. Then use a loop to produce the depreciation schedule: a list of years and the value of the item in that year. See below.
More Array Practice Use (R,G,B) of (0, 102, 204) for the page's background color to match the blue in the image. Take the third letter of the user's first name, the second and fourth letters of the user's last name, and find the corresponding silly name. Extract these letters, then use the silly name (see the PoopyStart.txt file below) that has the same position as the letter does in its array. You will need JavaScript's substring http://wwww.w3schools.com/jsref/jsref_substring.asp and toUpperCase http://www.w3schools.com/jsref/jsref_touppercase.asp and $.inArray() http://api.jquery.com/jQuery.inArray/. (If the person's name was not long enough, choose an index at random.) Finally concatenate the two silly names derived from the user's last name. Uses Prof_Poopypants.gif and PoopyStart.txt