Java Reference
In-Depth Information
Exercises
Visit www.myprogramminglab.com to complete many of these Exercises
online and get instant feedback.
EX 9.1
Draw a UML class diagram showing an inheritance hierarchy
containing classes that represent different types of clocks. Show
the variables and method names for two of these classes.
EX 9.2
Show an alternative diagram for the hierarchy in Exercise 9.1.
Explain why it may be a better or worse approach than the
original.
EX 9.3
Draw a UML class diagram showing an inheritance hierarchy
containing classes that represent different types of cars, organized
first by manufacturer. Show some appropriate variables and
method names for at least two of these classes.
EX 9.4
Show an alternative diagram for the hierarchy in Exercise 9.3
in which the cars are organized first by type (sports car, sedan,
SUV, etc.). Show some appropriate variables and method names
for at least two of these classes. Compare and contrast the two
approaches.
EX 9.5
Draw a UML class diagram showing an inheritance hierarchy
containing classes that represent different types of airplanes.
Show some appropriate variables and method names for at least
two of these classes.
EX 9.6
Draw a UML class diagram showing an inheritance hierarchy
containing classes that represent different types of trees (oak,
elm, etc.). Show some appropriate variables and method names
for at least two of these classes.
EX 9.7
Draw a UML class diagram showing an inheritance hierarchy
containing classes that represent different types of payment trans-
actions at a store (cash, credit card, etc). Show some appropriate
variables and method names for at least two of these classes.
EX 9.8
Experiment with a simple derivation relationship between two
classes. Put println statements in constructors of both the par-
ent and child classes. Do not explicitly call the constructor of
the parent in the child. What happens? Why? Change the child's
constructor to explicitly call the constructor of the parent. Now
what happens?
Search WWH ::




Custom Search