uc 17 v2 - yshehab/SchoolRoomBooking GitHub Wiki

17. Add a new member to an existing school. Version 2

TO DO - revise

Coordinating method

public void addMember(Name aName, Address anAddress, Email anEmail, School aSchool)

Object diagram for a typical scenario.

Walk-through for this scenario

Given: The Name object aName, the Address object anAddress, the Email object anEmail and the School object school12.

  1. Check that no Member object with the supplied attributes exists (linked to any Schools or Organizations in the system)
    As the check suceeds:
  2. A new Member object member6 is created with the supplied attributes
  3. member6 is linked to school12

Sequence diagram for this scenario

Notes on alternative scenario

If the Member already exists then throw an exception

Updates to implementation model

Classes

Class LettingCoord

Links
private collection <School> school

References a collection of all linked School objects

private collection <Organization> organizations

References a collection of all linked Organization objects

Methods
public void addMember(Name aName, Address anAddress, Email anEmail, School aSchool)

Postcondition: If a Member object exists in the system with the supplied attributes an exception is thrown, otherwise a new Member object, aMember, is created with the supplied attributes. aSchool records a reference to aMember

Class School

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

Postcondition: a reference to aMember is recorded.

public Boolean hasMember(Name aName, Address anAddress, Email anEmail)

Postcondition: returns True if the receivers members contains a Member with the supplied attributes

Class Organization

Links
Collection<Member> members
Methods
public Boolean hasMember(Name aName, Address anAddress, Email anEmail)

Postcondition: returns True if the receivers members contains a Member with the supplied attributes

Class Member

Links

None

Methods
Member(Name aName, Address anAddress, Email anEmail)

Post condition: a new Member object aMember is created. A reference to aMember is returned

Navigations

worksAt from School to Member

isMember from Organization to Member

Discussion

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