[an error occurred while processing this directive] File: index.shtml Creator: George Ferguson Created: Thu Sep 27 09:23:28 2012 Time-stamp: [an error occurred while processing this directive] File: templates/doc-start.shtml Creator: George Ferguson Created: Tue Dec 6 12:31:29 2011 Time-stamp: [an error occurred while processing this directive] File: site-settings.shtml Creator: George Ferguson Created: Tue Dec 6 13:49:49 2011 Time-stamp: Site (or subsite)-wide settings. [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] File: head.shtml Creator: George Ferguson Created: Tue Dec 6 12:34:15 2011 Time-stamp: SSI variables for this template: head_title if given, else ``sitename | title'' [an error occurred while processing this directive] File: head-title.shtml Creator: George Ferguson Created: Tue Dec 6 14:29:52 2011 Time-stamp: SSI variables for this template: head_title: complete content of title element if given site_title trailing part of title (if given) section_title middle part of title (if given) page_title leading part of title (if given) title title shown on page, also used as leading part of title (if given) [an error occurred while processing this directive] (none) [an error occurred while processing this directive] File: head-meta.shtml Creator: George Ferguson Created: Tue Dec 6 14:29:18 2011 Time-stamp: SSI variables for this template: meta_description meta_keywords meta_generator [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] File: head-stylesheets.shtml Creator: George Ferguson Created: Tue Dec 6 14:22:58 2011 Time-stamp: SSI variables for this template: site_stylesheet, page_stylesheet stylesheet0, stylesheet1, ...: URL for stylesheets [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] File: head-scripts.shtml Creator: George Ferguson Created: Tue Dec 6 14:23:19 2011 Time-stamp: SSI variables for this template: site_script, page_script script0, script1, ...: URLs of javascript scripts [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] File: body-start.shtml Creator: George Ferguson Created: Tue Dec 6 13:20:46 2011 Time-stamp: SSI variables for this template: body_class page_class page_id [an error occurred while processing this directive] [an error occurred while processing this directive] File: body-header.shtml Creator: George Ferguson Created: Tue Dec 6 13:46:12 2011 Time-stamp: Content above banner, if any. [an error occurred while processing this directive] File: body-banner.shtml Creator: George Ferguson Created: Tue Dec 6 13:27:12 2011 Time-stamp: Duplicate URCS Drupal banner. hajim urcs
Computer Science @ Rochester
Computer Science Department : Hajim School of Engineering & Applied Sciences Skip to main content [an error occurred while processing this directive] File: body-title.shtml Creator: George Ferguson Created: Tue Dec 6 14:34:49 2011 Time-stamp: SSI variables for this template: section_name First line of title on page (if any) title Title shown on page

[an error occurred while processing this directive] CSC170: Introduction to Programming and the Web
Fall 2012
[an error occurred while processing this directive]
Assignment 5: Iteration: Part 1

  1. [2 pts] Create a page that displays the square of each of the first ten integers starting at 1 using a table.
  2. [2 pts] Create a page that asks the user for a number and then displays the square of the ten numbers starting with that one, using a table.
  3. [4 pts] Suppose you're teaching a course where there are a set of assignments that are all worth the same number of points. Students can choose which assignments to do, so each student may do different assignments or different numbers of assignments. Create a page that helps with grading as follows:
    • Ask the user for the name of a student.
    • Ask the user for that student's grades on the assignments one at a time (for this exercise, it doesn't matter which assignment each grade is for).
      • Since we don't know how many assignments they did in advance, the user can enter -1 to stop entering grades for that student. Your prompt should probably make that clear...
    • Display the following using a table:
      • The collected grades (all in one table cell, separated by commas)
      • The student's average grade
      • The student's maximum grade
      • The student's minimum grade
      Make sure your table has informative column headers, and feel free to style the table to look better if you like.

Things to think about

  • Iteration allows you to repeat a statement or block. Combined with conditionals, you can do different things each time around the loop.
  • It is crucial that the body of a loop change something that (eventually) changes the value of the loop condition from true to false, otherwise the loop will never stop. See what happens when your browser executes a script with an infinite loop (hint: it ain't pretty).
  • Iteration is particularly nice for generating tables in web pages, no?

On to Part 2 when it is available...

[an error occurred while processing this directive] File: doc-finish.shtml Creator: George Ferguson Created: Tue Dec 6 13:46:48 2011 Time-stamp: [an error occurred while processing this directive] File: body-footer.shtml Creator: George Ferguson Created: Tue Dec 6 14:43:56 2011 Time-stamp: Content at bottom of page, if any.

Last update: Monday, 01-Oct-2012 19:04:24 EDT

[an error occurred while processing this directive] File: body-finish.shtml Creator: George Ferguson Created: Tue Dec 6 13:47:36 2011 Time-stamp: [an error occurred while processing this directive]