[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.
Login
[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
Page Not Found : Department of Computer Science : University of Rochester Skip to main content
Rochester shield
  • Apply
  • Visit
  • Give

Search Rochester.edu

Hajim School of Engineering & Applied SciencesDepartment of Computer Science

Site Navigation

  • About Us
    • Overview
    • What is Computer Science?
    • Employment
    • History
      • 50th Anniversary
      • PhDs Conferred
      • In Memoriam
    • Engagement and Enrichment
    • Giving
    • Contact Us
  • People
    • Full Directory
    • Faculty
    • Graduate Students
    • Staff
  • Undergraduate
    • Overview
    • BS in Computer Science
    • BA in Computer Science
    • Minor and Clusters
    • Courses
    • Advising
    • Getting Experience
    • CS Lab Information
    • Applying
  • Graduate
    • Overview
    • Master's Program
    • PhD Program
    • Courses
    • Applying
  • Research
    • Overview
    • Computer Systems
    • Theory
    • Artificial Intelligence
    • Human-Computer Interaction
  • News & Events
    • Recent News
    • Seminars & Talks
    • Newsletter
    • Distinguished Gifts
    • Commencement

Page does not exist.

  • Overview
  • What is Computer Science?
  • Employment
  • History
    • 50th Anniversary
    • PhDs Conferred
    • In Memoriam
  • Engagement and Enrichment
  • Giving
  • Contact Us
  • Home
  • About Us
  • Contact Us

Missing page.

Sorry. The page you requested does not exist on the Department of Computer Science website

Return to the Computer Science Home Page

Report a Digital Accessibility Barrier

Department of Computer Science

Location
University of Rochester
2513 Wegmans Hall
P.O. Box 270226
Rochester, NY 14627
Phone
(585) 275-5671

Resources for

  • Prospective students
  • Current students
  • Parents & families
  • Faculty & staff
  • Alumni

Schools & divisions

  • School of Arts & Sciences
  • Hajim School of Engineering
  • Eastman School of Music
  • School of Medicine & Dentistry
  • School of Nursing
  • Simon Business School
  • Warner School of Education
  • Laboratory for Laser Energetics

Libraries & collections

  • University Libraries
  • Memorial Art Gallery

Helpful links

  • Intranet
  • Web Communications
  • Contact
  • Directory
  • Human resources
  • UR Mobile (app)
  • Parking & shuttles
  • Information technology
  • Blackboard
  • myURHR
  • MyPath

Ever better

  • Global engagement
  • Accessibility
  • Vision & Values
  • Office of University Engagement and Enrichment
  • Nondiscrimination & Title IX

More URochester

  • News
  • Events
  • Athletics
  • Arts
Two University of Rochester students working on an experiment in a lab.Exterior profile of the University of Rochester’s Eastman School of Music. University of Rochester student plays the violin during a concert.
  • Facebook
  • YouTube
  • X / Twitter
  • TikTok
  • Instagram
  • LinkedIn
  • Threads
  • Follow URochester
Three University of Rochester sophomores posed together while wearing University of Rochester hats. The University of Rochester Rush Rhees Library bell tower at sunrise. Close up of a therapy dog’s nose on the University of Rochester river campus.
University of Rochester logo
  • Contact us
    (585) 275-2121
  • See maps and directions
    Rochester, NY

Search Rochester.edu

  • Privacy
  • Copyright
  • Emergency Information

© University of Rochester 1996–2026

[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] DMS102/CSC170D: Introduction to Web Development
Spring 2013
[an error occurred while processing this directive]
Assignment 5: Iteration

  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. [2 pts] Create a page that uses a for loop to demonstrate each of the six possible HTML heading types (h1..h6).
  4. [2 pts] Create a page that asks the user for a number n and then uses a for loop to compute the value of n! (the factorial function). I'll save you the trouble of looking it up: n! is the product of all the numbers from 1 up to and including n.
  5. [2 pts] Create a page that asks the user for a year (number) and displays whether or not it is a leap year. Use only one if statement with a Boolean expression to do the test. The definition of a leap year is a year that is evenly divisible by 4, but not evenly divisible by 100, unless also evenly divisible by 400.
  6. [4 pts] Create a page that helps with grading as follows:
    • Ask the user for the name of a student. If there are no more students, the user can enter "stop". (Make this clear in your prompt.)
    • For that student, ask the user to enter the student's grades one at a time. If there are no more grades, the user can enter "stop".
    • Display the following as a row in a table:
      • 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.
    • Repeat until the user enters "stop" for a student name. (Think about how you need to structure your loops to achieve this.)
    Note: Think about how/when you need to start and end your table.

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).
  • There are many ways to write iterative programs:
    • The book describes counter-controlled and sentinel-controlled loops, which are different ways of deciding when to end the iteration;
    • while, for, and do-while loops, which are different control statements for formulating your iteration in Javascript.
    Deciding how to express your algorithm using the various control constructs is part of the art of programming. But you should be familiar with all the tools in the toolkit so you can make the right choices when designing your program.
  • Iteration control constructs can be nested, just like HTML elements and conditionals. Makes you think that nesting (embedding) is kind of an important concept, no?
  • Iteration is particularly nice for generating tables in web pages, no?
[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: Thursday, 07-Feb-2013 11:08:24 EST

Department of Computer Science · University of Rochester
734 Computer Studies Bldg. · P.O. Box 270226 · Rochester, NY 14627
tel: 585 275-5671 · fax: 585 273-4556 · info@cs.rochester.edu
Hajim School of Engineering and Applied Sciences
[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]