This webpage contains announcements about A1.
Some people may find it easier to think of these methods and
therefore to write them as: equals(ClassRoom)
for the ClassRoom class,
and equals(AVEquipment), for the
AVequipment class. You may write them this way if
you prefer, or you can stick with the original
equals(Object) for both classes.
Either way is acceptable.
An alert reader has brought to our attention that we wrote Classroom in a couple of places where we should have written ClassRoom.
Fixed.
A NullPointerException is Java's way of letting you
know that somewhere you are referring to an object's method
or variable when the object itself is null. This
can happen if you did not properly initalize your objects in
your test cases. You simply have to find these cases and fix
them - java tells you where in your file the
NullPointerException has originated.
One other way (perhaps the only other way) that this can happen
is if you are comparing the AVEquipment of two ClassRoom
objects, and one ClassRoom has no AVEquipment at all (so the
value of the variable holding the AVEequipment object is
null. In this case, you are probably calling on
the equals() method of the non-existent
AVEquipment object.
If this problem happens during our testing of your program, we will not take off points, but you might find it frustrating to have to deal with it during your own testing. To see how you may avoid this, please read the updated Hints section of the assignment page.
isPortable() method
in ClassRoom?
Presumably it is meant to return something having to do
with the last boolean variable defined
for ClassRoomwhich indicates whether the room
is a temporary structure. But the initial value of this
variable is never specified or given in a constructor,
and there is no method to set its value. Explain please.
Agreed - there is not much point to
isPortable(). Please implement it anyway, as
an exercise in yet another method and variable.
Also agreed:
the initial value of the boolean that
isPortable() is related to was not specified.
Here is the specification that we omitted: in
this assignment, ALL classrooms are created as
permanent structures (and of course, there's no way to
change that after the room is created).