CSCI 201 Spring 2004

Short Homework 2

In this homework, you will begin to write and use classes that have instance variables. In the first part of the assignment, you must complete a partially written class named Box2D. As indicated in the comments in Box2D, you will complete the class by adding instance variables and a constructor method. Box2D will not compile until you have made these additions; be sure to use the indicated names for the instance variables.

In the second part of the assignment, you complete the partially written class named BoxDemo. The BoxDemo class uses the Box2D class---it creates Box2D objects and calls their methods. Complete the BoxDemo class as described in the comments in that class. When you have completed that code, you will have created a Box2D object and called several of its methods. Your output window should look something like the following:

Submitting Your Assignment

The program written for this assignment must be turned in by placing both files (i.e., Box2D.java and BoxDemo.java) in your csci/201/Box2D directory (you will have to create this directory). This assignment must be completed by midnight of Wednesday March 24th to receive full credit.