HW3 - Control Statements 1


Part 1

Create a webpage that contains a script that will prompt the user for a student's homework average and final exam score (both as integers). Calculate the student's final average according to the formula: final average = .7 * hwAvg + .3 * finalExam

Part 2

Create a webpage that contains a script that inputs one salesperson's items sold for last week, calculates the salesperson's earnings and outputs HTML or XHTML text that displays the salesperson's earnings. For data input, use 4 prompts for the number sold for each of the items 1-4.

Part 3

Create a webpage that contains a script that will determine the gross pay for each of three employees. The company pays "straight time" for the first 40 hours worked by each employee and pays "time and a half" for all hours worked in excess of 40 hours. You are given a list of the employees of the company, the number of hours worked last week and the hourly rate of each employee. Your script should input this information for each employee, determine the employee's gross pay and output HTML or XHTML text that displays the employee's gross pay. Use prompts to input the data.

Part 4

A palindrome is a number or a text phrase that reads the same backward and forward. For example: 12321, 55555, 11611, 45554. Create a webpage that contains a script that reads in a five-digit integer and determines whether it's a palindrome. If the number is not five digits long, output HTML or XHTML text that displays an alert dialog indicating the problem to the user. Allow the user to enter a new value after dismissing the alert dialog.

Extra Credit

Create a webpage that contains a script that reads in the size of the side of a square and outputs HTML or XHTML text that displays a hollow square of that size constructed of asterisks. Use a prompt dialog to read the size from the user. Your script should work for squares of all side sizes between 2 and 10. Display an error message if the user enters any number that is not between 2 and 10.



back

Hosted by www.Geocities.ws

1