Java Reference
In-Depth Information
EX 10.2 Draw and annotate a class hierarchy that represents various
types of animals in a zoo. Show what characteristics would be
represented in the various classes of the hierarchy. Explain how
polymorphism could play a role in guiding the feeding of the
animals.
EX 10.3 Draw and annotate a class hierarchy that represents various
types of sales transactions in a store (cash, credit, etc.). Show
what characteristics would be represented in the various classes
of the hierarchy. Explain how polymorphism could play a role
in the payment process.
EX 10.4 What would happen if the
pay
method were not defined as an
abstract method in the
StaffMember
class of the
Firm
program?
EX 10.5 Explain how a call to the
addMouseListener
method represents
a polymorphic situation.
EX 10.6 Draw the containment hierarchy tree for the
SlideColor
program.
Programming Projects
Visit
www.myprogramminglab.com
to complete many of these Programming
Projects online and get instant feedback.
PP 10.1 Modify the
Firm
example from this chapter such that it accom-
plishes its polymorphism using an interface called
Payable
.
PP 10.2 Modify the
Firm
example from this chapter such that all employ-
ees can be given different vacation options depending on their
classification. Modify the driver program to demonstrate this new
functionality.
PP 10.3 Implement the
Speaker
interface described in Section 10.3, and
create three classes that implement
Speaker
in various ways.
Create a driver class whose
main
method instantiates some of
these objects and tests their abilities.
PP 10.4 Rewrite the
Sorting
class so that both sorting algorithms put
the values in descending order. Create a driver class with a
main
method to exercise the modifications.
PP 10.5 Modify the
Movies
program from Chapter 8 so that it keeps the
DVDs sorted by title.
VideoNote
Developing a solution
of PP 10.1.
Search WWH ::
Custom Search