WDV221 Intro Javascript

Final Exam Project

Array Handling

Arrays are used to store data, process data and to lookup data. Arrays can be loaded in your javascript and can be dynamically updated with your javascript as your page is processed. Make all changes to this page.

1. Create a array called productNames. It will have the following values: shoes, socks, sandals, shorts, shirts

2. Create a parallel array called productSales. It will have the following values: 170.50, 110.25, 3130.75, 125.50, 80;

3. Total Sales are:

  1. Button will call a function
  2. The function will use a loop to add the productSales together
  3. Display results in the area above.
  4. The result should be properly formatted as a dollar amount. Use a function or script that works with any amount.

4. This button will take the requested product and display the corresponding Sales amount or a 'Product Not Found' message.

Product:

Product Sales:

5. The following form will ask for the product name and sales amount. If the product is in the array it will add the sale amount to that product's sale amount. If the product is not in the array it will add the product to the array and add the new product's amount to the productSales array.

Product:

Product Sales:

6. Create a button that will display the productNames array in an alert.

7. Create a button that will display the productSales array in an alert.

Rubric: Points for 1. and 2.

0 Not attempted

3 Attempted but not correct.

5 Correctly written

Rubric: Points for 3.-7.

0 Not attemped

3 Displays something

4 Displays correct values, but not formatted

5. Displays correct values, properly formatted