Programming and Problem Solving with Java

(やまだぃちぅ) #1

CASE STUDY^305


entry. We can add more information as we go on. Here then is our filtered list of classes
for this application:


Determining Responsibilities:Let’s look at the Entry class as it was left when we stopped
the scenarios.


We can omit the “Know birthday” responsibility for the time being. Our driver needs
to create one instance of Entry at a time and write it to a file.Create!We forgot to list
Create as a responsibility. Because each class should be as encapsulated as possible,
let’s have two constructors: one that inputs values into its own fields and one that


Class Name: Entry Superclass: Subclasses:


Responsibilities Collaborations
Know name None
return Name

Know address None
return Address

Know phone number None
return Phone

Know birthday None
return Date

Entry


Name


Address


Phone number


User interface

Free download pdf