| Part 1 |
Create a webpage that contains a script, using the for statement,
that calculates the product of the odd integers from 3 to 17 and then outputs
HTML or XHTML text that displays the results. (Note: You should print only one
line that contains the result of 3 * 5 * 7 * 9 * 11 * 13 * 15 * 17)
|
| Part 2 |
Create a webpage that contains a script that will calculate compound
interest on a principal of $1000 for interest rates of 5, 6, 7, 8, 9, and 10%,
for years 1 through 10. The formula to use is :
P is the principal (the initial amount you borrow or deposit)
r is the annual rate of interest (percentage)
n is the number of years the amount is deposited
A is the amount of money accumulated after n years, including interest
A = P(1 + r)n
|
| Part 3 |
A mail-order house sells five different products whose retail prices are
as follows: product 1, $2.98, product 2, $4.50, product 3, $9.98, product 4,
$4.49, product 5, $6.87. Create a webpage that contains a script that reads a
series of pairs of numbers as follows:
a) Product number
b) Quantity sold for that product - (for the week)
Your script should use a switch statement to help determine the retail price
for each product and should calculate and output HTML or XHML that displays the
retail amount for each product and the total retail amount of all the products
sold last week. Use prompts to obtain the product number and the quantity sold
for each product from the user. Use a sentinel-controlled loop to determine when
the program should stop looping and display the final results.
|
| Part 4 |
Create a webpage that contains a script that reads five numbers
between 1 and 20. For each number read, output HTML or XHTML text that displays
a line containing the same number of adjacent asterisks. For example, if your script
recieves prompted values of 7, 3, 10, 1, and 4, then it should output HTML or XHTML as follows:
*******
***
**********
*
**** If a prompted value is less than 1 or greater than 20, then alert an appropriate error response.
|
| Extra Credit |
Create a webpage that contains a script that uses repetition and switch statements to
print the song "The Twelve Days of Christmas". One switch statement should be used to print
the day (i.e., "First," "Second," etc.). A separate switch statement should be used to print the remainder of each verse.
|
back
|