Programming and Problem Solving with Java

(やまだぃちぅ) #1
317

15.In what stage of the CRC card process do we identify responsibilities for
classes? (pp. 280–285)
16.Does each CRC card result in the creation of a new class? (pp. 274–275)
17.Suppose you want to create a class that has all of the responsibilities of an ex-
isting class, but adds some new responsibilities. Would the new class be a
superclass or a subclass of the existing class? (p. 285)
18.What should be the file name for a compilation unit that has a publicclass
called SomeClass? (pp. 295–299)
19.What is the Java syntactic construct that bundles related classes? (pp. 295–299)

Answers


1.Nouns 2.True 3.A method 4.By sending messages in the form of method calls 5.Inherit 6.One 7.Yes 8.Use
passwords that are difficult to guess, encrypt the data, store backup copies of the data securely, use or
develop well-engineered software that avoids security loopholes 9.Small 10.False 11.We eliminate candidate
classes that are duplicates, or clearly not part of the problem.12.The name of the class, its superclass and
subclass relationships, its responsibilities, and its collaborators 13.A common case 14.A message passed be-
tween them, which is usually a method call, but can also involve the use of publicfields 15.During the sce-
nario walk-through 16.No. A CRC card may refer to an existing class that can be used directly.17.A subclass
18.SomeClass.java19.package


Exam Preparation Exercises


1.Distinguish between the OOD and functional decomposition methodologies in
terms of what aspect of a problem each focuses on.
2.Distinguish between the OOD and functional decomposition methodologies in
terms of what kind of design each produces.
3.If it is natural to think of the solution to a problem in terms of a collection of
component parts, which design technique is more appropriate?
4.If a method is modified by static, is it a class method or an instance method?
5.What are class members?
6.What is the public interface to a class?
7.Why would we want to have a private part of a class?
8.Name four responsibilities that might be associated with a class that repre-
sents a date.
9.Name two responsibilities that could be associated with a class that represents
an exam score.
10.What are the responsibilities of the BufferedReaderclass that we have discussed
in this text?
11.What are the responsibilities of the PrintWriterclass that we have discussed in
this text?
Free download pdf