Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

help identifying classes

  Asked By: Tracey    Date: Nov 12    Category: Java    Views: 840
  

here is a small piece of text and i need some help to identify the
classes in it:

Mobile phones offer the facility for creating personalised
phonebooks of a limited capacity and typically allowing for the
storage of a contact and associated phone number. It is usually
possible to order the entries held in a phonebook in a variety of
ways. For example, entries may be ordered by frequency of use,
alphabetically on the name of the contact or in a sequence specified
by the user of the phone.
Retrieving a particular number from a phonebook can be done in a
variety of ways.Typically by providing the name, or a part of the
name, of a contact or by specifying a location with in the book.
Also facilities for removing a contact from the book or changing the
number associated with a contact are provided.


so far i have identified:

phoneBook
contactName

are these correct? where are the others? i can't see them.

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Zoar Mizrachi     Answered On: Nov 12

I see two classes:

- Contact (which containts the name  and the phone  number)
- PhoneBook (a set of contacts)

The relationship between this two classes  is Whole-Part
or Aggregation, also known as the Composite pattern.
You can say "a PhoneBook contains various Contacts,
a Contact is contained in a PhoneBook".

Then you can say that contactName and phoneNumber are
attributes of the Contact class.

And an array, vector or any other structure that holds
various Contact objects can be the attribute of the
PhoneBook class. This class can include also the methods
to mantain the list of contacts: search, insert, delete,
etc.

P.S.: This is just the Analysis Phase, in the Design
Phase you will add more classes, depending on the
language, pattern, etc. you will use.

 
Didn't find what you were looking for? Find more on help identifying classes Or get search suggestion and latest updates.




Tagged: