Java Reference
In-Depth Information
Chapter Summary
The Unified Modeling Language (UML) is a graphical representation language for
object-oriented software design.
Patterns are design principles that apply across a variety of software applications.
The patterns discussed in this chapter are the Container-Iterator , Adaptor , Model-
View-Controller , and Divide-and-Conquer Sorting patterns.
UML is one formalism that can and is used to express patterns.
Answers to Self-Test Exercises
1. There are many correct answers. The following is one:
Circle
— radius: double
— centerX: double
— centerY: double
+ resize( double newRadius): void
+ move( double newX, double newY): void
# erase(): void
. . .
2. The method sameName is not listed in the class diagram for Student . So, you
follow the arrow to the class diagram for Person . The method sameName with a
single parameter of type Person is in the class diagram for Person . Because you
know a Student is a Person , you know that this definition works for the method
sameName with a single parameter of type Student . So, the definition used for the
method sameName is in the class definition of Person .
3. You start at the class diagram for Student . The method setStudentNumber with a
single parameter of type int is in the class diagram for Student , so you need look
no further. The definition used for the method setStudentNumber is in the class
definition of Student .
4. The code for this is also on the website that comes with this topic. This code is
in the file SelectionSort.java . A demonstration program is in the file
SelectionSortDemo.java .
extra code
on website
 
Search WWH ::




Custom Search