Homework 2 | CS 4, Summer 2007 | Due: July 13



Directions: Submit hardcopies (paper copies) of your solution to the written questions (W). For the HTML questions (H), submit a hardcopy of your HTML code and write on the hardcopy the URL that contains the web page (e.g., www.dartmouth.edu/~farid/cs4/hw2_q2.html and www.dartmouth.edu/~farid/cs4/hw2_q3.html). Make sure to place your name on the first page of your fully stapled homework. The point values for each question are as specified.
  1. (H: 0) Update your cs4/index.html file to contain links to each part of your Homework #1 and Homework #2 solutions. For example, when we visit your web page we might see something like (these links are intentionally broken, your links obviously shouldn't be):

    Homework #1: question 3 | question 4
    Homework #2: question 2 | question 3

    For future homeworks we will ask you to continue to update this document, so that the graders can easily locate your homework solutions.

  2. (H: 20) Below are links to five images. Click on the link to view the image. Save each image to your computer by dragging the image to your desktop. You will also need to upload these images to your web page when submitting your homework.

    Images: bob.jpg | burns.jpg | flanders.jpg | krusty.jpg | willy.jpg

    Create a table with these five images and some text that looks like:


    (click for a full-resolution version)

    Each image should be placed in a single table cell. Set the width of the table to be 743, the width of the first column to 250, the width of the second column to 250, and the third column to 243. Pay attention to the horizontal alignment of each image and make sure to replicate this in your solution.

  3. (H:20) Image maps allow you to make different parts of an image link to different things. For example ivy.html is an image map for the Ivy League schools. Currently, the first two schools are linked to their respective web pages. Download the source code for ivy.html and the image ivy.jpg to your computer. Using the existing code as a template, fill in the remaining code so that the six other schools are linked to their respective web pages.

    Hint: you need only add six more lines of HTML code that look very similar to the lines that link the first two schools. The tag arguments coords="1,1,243,45" and coords="1,46,243,90" specify the rectangular region of the image ivy.jpg that when clicked will link to the corresponding web page (Brown and Columbia, respectively). The Brown rectangle spans the full width of the image (from 1 to 243 pixels), and a height from 1 to 45 pixels (the height of the text). The Columbia rectangle also spans the full width of the image (from 1 to 243 pixels), and has a height of 45 pixels, but now from pixels 46 to 90.

    The following written problems are from "Invitation to Computer Science":
  4. (W: 10) Chapter 1, Exercise 7a and 7b
  5. (W: 10) Chapter 1, Exercise 9
  6. (W: 10) Chapter 2, Exercise 3
  7. (W: 10) Chapter 2, Exercise 8
  8. (W: 10) Chapter 2, Exercise 15
  9. (W: 10) Chapter 2, Exercise 19