Jonathan Oberhaus

Jonathan Oberhaus

  • NA
  • 6
  • 10.8k

Class diagram questions

Nov 12 2012 11:33 PM
First off...no, I don't want the answer.  I have some homework to make a class diagram for a c# program.  There's is quite a lot of things I don't know how to do with this statement.  I don't want the answer, just some guidance or to point me in the write direction.

So far I have this:

Classes:
Person(base)
Parent(derived from Person)
Daughter(derived from Person)
happyHouse

I have attributes for those, but my real problem is understanding how the classes would "communicate."  Also how does a class "know" about another class?
I posted the assignment below, any hints or direction would be greatly helpful:





"Jack and Jane Simson live happily in their house with their two daughters, Sandra and Susan. All 
of them, being people, have first names, last names, and ages. The parents, Jack and Jane, have 
occupations as well as incomes. The parents being parents always know that they have two 
loving daughters (assume two and only two!) and they are able to, as you would expect, interact 
directly and independently with each of their children. It is also the case that while they both 
have two daughters, there are really only two of them: Jack's daughter Susan is the same as 
Jane's daughter Susan! 

Each of the siblings, being sisters, knows that she has a sister. They can also nudge each other 
and pass messages. Jack and Jane also individually know that they have a spouse and directly 
talk with them.

The daughters get an allowance from their parents. As such, anybody can call on them to give 
them an allowance but it is typical practice that Jane Simson gives them the allowance. The girls 
keep a track of how much allowance they have accumulated in total. They can spend a certain 
amount of money, which obviously affects how much money they have left. Whenever they get 
money, they proudly announce to the world (or the Console as the case might be!) that they have 
received an allowance and how much money they have. They also tell their sibling!
The happy house that they live in contains everybody that resides in the house – namely, both the 
parents and both the children. As strange as it sounds, it can "create" instances of everybody in 
the house! It can also set into motion a set of action-events that give definition to everybody in 
their house – their names, ages, incomes, etc. It can provide the world with a status of the happy 
lives that each of their resident lives!

Design a class diagram that captures the classes that you would need as well as their attributes, 
methods, and relationships between those classes."

Answers (1)