uc 20 - yshehab/SchoolRoomBooking GitHub Wiki

20. Add an existing member to an existing school

Coordinating method

public void addMemberToSchool(Member aMember, School aSchool)

Object diagram for a typical scenario.

Walk-through for this scenario

Given: The Member object, member34 and the School object school3

  1. Check if member34 is linked to school3.
    As member34 is not linked to school3:
  2. school3 records a reference to member34

Sequence diagram for this scenario

Notes on alternative scenario

If Member is already a member of the school, do nothing

Updates to implementation model

Classes

Class School

Links
  • Collection<Member> members
Methods
  • void addMember(Member aMember)

Class LettingCoord

Links
  • None
Methods
  • public void addMemberToSchool(Member aMember, School aSchool)

Navigations

  • worksAt from School to Member

Discussion

This scenario may change if it is decided that StaffMember be a sub-class of Member, in which case a check would need to be made that aMember is an instance of StaffMember. An exception would need to be thrown in this case.

⚠️ **GitHub.com Fallback** ⚠️