Java Reference
In-Depth Information
EX 7.11 Explain why a static method cannot refer to an instance variable.
EX 7.12 Can a class implement two interfaces that each contains the same
method signature? Explain.
EX 7.13 Create an interface called Visible that includes two methods:
makeVisible and makeInvisible . Both methods should take no
parameters and should return a boolean result. Describe how a
class might implement this interface.
EX 7.14 Draw a UML class diagram that shows the relationships among
the elements of Exercise 7.13.
EX 7.15 Imagine a game in which some game elements can be broken by
the player and others can't. Create an interface called Breakable
that has a method called break that takes no parameters and
another called broken that returns a boolean result indicating
whether that object is currently broken.
EX 7.16 Create an interface called VCR that has methods that represent
the standard operations on a video cassette recorder (play, stop,
etc.). Define the method signatures any way you desire. Describe
how a class might implement this interface.
EX 7.17 Draw a UML class diagram that shows the relationships among
the elements of Exercise 7.16.
EX 7.18 Draw the containment hierarchy tree for the LayoutDemo program.
EX 7.19 What visual effect would result by changing the horizontal and
vertical gaps on the border layout used in the LayoutDemo pro-
gram? Make the change to test your answer.
EX 7.20 Write the lines of code that will define a compound border using
three borders. Use a line border on the inner edge, an etched bor-
der on the outer edge, and a raised bevel border in between.
Programming Projects
Visit www.myprogramminglab.com to complete many of these
Programming Projects online and get instant feedback.
PP 7.1
Modify the Account class from Chapter 4 so that it also permits
an account to be opened with just a name and an account num-
ber, assuming an initial balance of zero. Modify the main method
of the Transactions class to demonstrate this new capability.
VideoNote
Developing a solution of
PP 7.1.
PP 7.2
Modify the Student class presented in this chapter as follows.
Each student object should also contain the scores for three
 
Search WWH ::




Custom Search