CIS89C: Client-Side Programming with JavaScript

Week 4

Assignment 4


Arrays and Loops


Due Date: Week 5 Day 1
50 points (Layout: 10, Content: 40)

DO NOT USE ANYTHING THAT WE HAVE NOT LEARNED YET. THE LESSONS STOP AT WEEK 4. We want to learn step by step, i.e. be able to use what we have learned during the first 5 weeks.

Think along the line of your business, hobbies, or personal Web site.

Create a database of products. So create a link called Catalog of Products. When clicked, the catalog page is loaded.

Depending on what kind of products you offer, do the following:

  • create a product object that has some properties. The properties can consist of, but not limited to: name, color, year, price, etc. (they vary depending on the products)

    for example:

    • for car: model, year, VIN, mileage, condition, price, etc.
    • for book: title, author, year, ISBN, number of pages, price, etc.
    • for flower: color, description, price, etc.

  • build a two-dimensional array of products. The first array consists of categories. Each category is an array of products. Each product is an instance of the product object.

    For example, a category can be:

    • for car: Honda, Toyota, Ford, etc. (So you can create an array of Honda, Toyota, Ford, etc.)
    • for book: Fiction, History, Adventure, Philosophy, Science, etc.
    • for flower: Roses, Tulips, Daisies, etc.

    For example a Honda can consist of :

    • Civic, 1997, VIN#123435678, 30000 miles, good condition, $12000, etc.
    • Accord, 1990, VIN#203948574, 100000 miles, good and running, $1000, etc.
    • So an instance of a car can be a Honda. And Honda can be an array of Accord, Civic, etc.

    Display all the products by categories in a nice table.

      Make Year VIN Mileage Description Price
    Honda Civic     
     Accord     
    Toyota Tercel     
     Camry     

    Use the products that are related to your business.

    If the theme of your site is not about business, think of something that will do the same thing by cataloging your hobbies, personal items, etc.

    Make sure to read the requirements very carefully. Once your lab is submitted, it's not allowed for you to redo it. I do not regrade. One day late is 10% off. A perfect assignment with more than 2 weeks late will get a maximum of 10% only.

    Email me in the format shown below to inform me that your lab is ready to be graded. I highly suggest you send yourself a courtesy copy (cc).

    {Your name}
    {Your Voyager account name (e.g. xyz36459}
    {Class: CIS89C}
    {Assignment #4}

    I cannot grade if I don't receive your email.