Logo of the Augustana Faculty of the University of Alberta

COMPUTING SCIENCE 120 — Abstraction, Design, and Object-Oriented Programming


Programming Assignment 2



Due Date: Tuesday, April 4

Note that the due date for this lab has been postponed from the original due date as announced in the course outline.

Objectives

Assignment

Moveable Shapes: Do Programming Project Project 11.1 (page 441). Use an ArrayList inside your AnimationPanel to store a list of MoveableShape objects that should be moved and drawn.

To control the movement of shapes within the graphical frame, use a Timer and an ActionListener declared as an inner class, as discussed in Sections 11.5 and 11.6 (pages 424–430). However, you will want to create the timer and action listener inside the AnimationPanel object rather than in a main method of a tester class.

Provide a viewer class to demonstrate your AnimationPanel class and moveable cars and rectangles. In addition to creating and configuring a JFrame object, your viewer class should construct an AnimationPanel object and add at least two cars and two rectangles to the panel.

You may find it helpful to study the solution to Exercise P11.15, which is available on the Textbook Student Companion Site.

Grading

Your solution should display the following characteristics:

  1. Correctness - The program should conform to the specifications for which it was written. It should include correct handling of error conditions as specified above.

  2. Design and Efficiency - Each class should be constructed from small, coherent methods. The control constructs and data structures used should be those appropriate to the problem at hand. The program should not perform unnecessary steps, use extraneous variables, nor implement the algorithm in a contorted or inefficient way.

  3. Style and Documentation - The program should conform to generally accepted principles of style, such as a consistent pattern of indentation, use of meaningful identifiers, generous use of space, etc., as specified in the Programming Style Guide (see Appendix A, pp. 863ff.) Internal documentation should include class and method headers, and in-line comments to clarify the code where appropriate.

This assignment will account for 6% of your final grade in the course.

Submit your source code (i.e., your .java files) electronically using the following submission form. The names of Java files shown in the form are meant to be suggestive; you may have used different names for some of your files and classes. You may have fewer or more files than indicated below; you can use the first box of the form to submit an additional file or files as necessary.

You may submit one or more of your files multiple times; only the last version submitted will be graded. Late submissions will be accepted, but will be subject to a penalty of 1% per hour or portion thereof.

Web Password

Your assignment submissions are password-protected. These passwords apply only to form data submitted via the Web server. They are separate from (and typically different from) your network password.

 
Copyright © 2006 Jonathan Mohr