Assignment A1   CS100J    Spring 2005    DueTuesday, 8 February, IN CLASS

Start ProgramLive (the CD), turn to Lesson page 4.1, and click on the Labs icon. Do the first lab, "Drawing Object II". This requires you to draw a few objects (manila folders). Please hand it in at the BEGINNING of lecture on Tuesday, 8 February.

It shouldn't take more than 1/2 hour to do this assignment.

Please note the following. Any class that does not extend another class automatically extends class Object, which is in package java.lang. So, writing

public class Whatever { ...}

has exactly the same effect as

public class Whatever extends Object { ...}

Class Object has two important methods that you will learn about: function equals(Object) and function toString(). You don't have to know what they are for yet, just that they are declared in class Object.

It is important that you know how to draw an instance of a class yourself, following our conventions. Only then can you fully understand howclasses and instances of classes work in Java.

Last semester, when we gave this homework, many students did miserably. We explained what they did wrong and gave them another chance to learn. So that you don't have this problem --we won't be giving second chances--, here are notes that we gave out to the students who did things wrong. After completing this assignment, read through these notes and see whether you made the same mistakes. If so, correct them.

Note 1. You did not follow directions at all. We do not see, separately, an instance of Ex, an instance of Sub, an instance of SubSub1, etc. You may have put them all together in one picture, but that is not what we asked for and it shows no understanding of drawing folders. 20 points off.

Note 2. In a folder like one for SubSub1, you placed all the components together in one place. You did not put those for Ex on top, then those for Sub next, and finally those for SubSub1 at the bottom. 50 points off.

Note 3. You did not draw field p of Subsub2 as a variable --either with a line after it or a box after it. 5 points off.

Note 4. You left off the part for superclass Ex and/or Sub in your diagrams. You did not follow directions. 20 points off.

Note 5. You did not draw variables correctly. They should be drawn with the name of the variable followed either by an underline with the value on it or by a box with the value in it. 5 points off.

Note 6. Method what and field Zero in class Ex are static. Therefore, they should not be drawn in each folder of class Ex --they belong separately in the file drawer for Ex. 5 points off.

Note 7. In drawing a folder for SubSub2, you put in it a place for SubSub1 components. That is not correct. SubSub2 extends Sub, not SubSub1. 15 points off.