CCSF Spring 2010 / CNIT 133 Homework 6 - Arrays

Link to... Description
Part 1a This is a webpage containing a form that displays an input text box, radio buttons, checkboxes, and select items; along with a script that executes form validation. Your script should validate whether the user has entered data in the input text box, has checked a radio button, has checked at least one checkbox, and has selected an option from the select items. In your form statement, use a mailto action and enctype of text/plain. Use a submit button to invoke the validation scripts, so that the form is only sent when the form fields are valid. If a field is invalid then alert a message to the user. If the user clicks the reset button, confirm that the user truly wants to do this.
Part 1b Create a webpage that contains a script that utilizes 2 pulldown menus, one using an onChange event handler and the other using an onClick event handler. Each pulldown menu should include at least 3 URL destinations.
Part 2 Given a table of data about several of our states, create a webpage that enables the user to enter a state name (full or abbreviated) and have the State Name, State Capital, and population appear in separate form text fields of the page. The user should be able to start the script by pressing the button, "State Info". Just use the states that are given in the following table for your array. Allow for the user to enter state info in either lower case or upper case letters. Make sure you validate the input for a correct state abbreviation or state name. If the input is invalid then alert an error message

State Abbreviation State Name Capital Population
AL Alabama Montgomery 4,369,862
AZ Arizona Phoenix 4,778,332
AR Arkansas Little Rock 2,551,373
CA California Sacramento 3,145,121
CO Colorado Denver 4,056,133

Part 3 Use a one-dimensional array to solve the following problem:
A company pays its salespeople on a commission basis. The salespeople receive $200 per week plus 9% of their gross sales for that week. For example, a sales person who grosses $5000 in sales in a week receives $200 plus 9% of $5000, or a total of $650. Create a webpage with a script (using an array of counters) that obtains the gross sales for each employee through an XHTML form and determines how many of the salespeople earned salaries in each of the following ranges (assume that each salesperson's salary is truncated to an integer amount):

For input, the following facts should be available in form input text boxes:
  1. $200-299
  2. $300-399
  3. $400-499
  4. $500-599
  5. $600-699
  6. $700-799
  7. $800-899
  8. $900-999
  9. $1000 or more
Part 4 Create a webpage that contains a script, using a one-dimensional array to solve the following problem:M
Read in 10 numbers, each of which is between 10 and 100. As each number is read, print it only if it is not a duplicate number that has already been read. Provide for the possibility in which all 10 numbers are different. Be sure to validate the input, that is, if the number is not between 10 and 100 then alert an error message.

Valid XHTML 1.0 Strict Valid CSS!