Instructions: Answer as many of the following questions as you can during the lab period. If you are unable to complete the assignment during the lab period it is strongly recommended that you complete it on your own.
Getting Ready: Before going any further, you should:
TwoPartMeasure.java
.
TwoPartMeasure.java
to ensure that it has no
syntax errors.
abstract
modifier from the declaration of
the TwoPartMeasure
class and the declaration of the
initializeUnits
method.
TwoPartMeasure
class.
abstract
modifiers that you removed in step 3.
TwoPartMeasure
class.
initializeUnits
method.
TwoPartMeasure
class.
initializeUnits
method.
Driver0.java
.
Driver0.java
.
measure
variable
generate a compile-time error?
Length.java
.
Driver1.java
.
Driver1
.
initializeUnits()
in the Length
class.
Length
class.
initializeUnits()
in the Length
class.
Weight
class (containing pounds and ounces)
that extends the TwoPartMeasure
class.
Driver2.java
.
Driver2
class.
myLength.equals(myWeight)
generate a compile-time
error?
Driver2
.
LengthDatabase.java
and
DatabaseDriver1.java
.
DatabaseDriver1
.
DatabaseDriver2.java
that creates
and store Weight
objects in the
LengthDatabase
rather than Length
objects.
DatabaseDriver2
.
MeasurementDatabase
.
DatabaseDriver1
and
DatabaseDriver2
so that the database they
use is a MeasurementDatabase
. Make sure you change
both the declaration and the instantiation.
DatabaseDriver1
.
DatabaseDriver2
by casting the value returned by
database.get(name)
to the appropriate type.
Copyright 2011