[an error occurred while processing this directive] File: part2.shtml Creator: George Ferguson Created: Thu Sep 27 09:38:29 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] CSC170: Introduction to Programming and the Web
Fall 2012
[an error occurred while processing this directive]
Assignment 5: Iteration

  1. [2 pts] Create a page that uses a for loop to demonstrate each of the six possible HTML heading types (h1..h6).
  2. [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.
  3. [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.
  4. [4 pts] Building on the example from Question 3 of Part 1, this time we will process all the students in the class, not just one. So create a page that helps with grading as follows:
    • Ask the user for the name of a student. If there are no more students to enter, the user can enter "stop".
    • As before, ask the user for that student's grades on the assignments one at a time, entering -1 to stop entering grades for that student.
    • Display the collected grades, number of grades, and average grade for each student as well as the class average, using a table. Since each student may have different numbers of grades, you can display all the individual grades in one table cell. That is, your columns are (probably) name, grades, number of grades, and average grade.

Things to think about

  • 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?

[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:05:13 EDT

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]