Help with Class designs
As part of an assignment i have to come with some class diagrams for :
Customer, MobilePhone , PackageCategory, Manufacturer, LatestPhones, CreditCardDetails
I have identified the attributes but need the methods to the follwing classes:
Customer (Class Name)
Name
Full Address
Telephone Number
Email Address
Password
Package (Class name)
Pay as you go
Contract
Manufacturer (class name)
Product Code
Key features
Price
CreditCardDetails
TypeOfCard
NameOfCardholder
CardNumber
ExpiryDate
SCC number
What would be an example of the methods used
Hi,First of all you should have getter and setter methods for the attributes and also depending upon your need you can have as many method you want...like String getName(), setName(String name) etc..Hope this will help you...-Abhay
If you only need to come up with a class diagram, but do not know what functionality the system will require in the end - you should not worry about methods at this stage. Try thinking about the relationships between the classes. Ask yourself some questions about the model.
Can a customer have more than one phone? Maybe.
Can a phone be on more than one plan? No.
etc.
etc.
After I have the class models. I usually will find the relationship between the class models I created:
1. Creation
What creates what? For example, UserFactory creates and deletes User object.
2. Ownership
What has what? For example, User has exactly one CreditCardDetails. The relationship can be 1-1, 1-n, n-m. We can use setter/getter methods for this.
3. The interaction.
What does what? For example, you only allow credit card access/create/update only thru User object. You can pass other class as parameter and expect other class as result.
rgds,
Alex