uc 23 - yshehab/SchoolRoomBooking GitHub Wiki
public void addMemberAndOrganization(Name memberName, Address memberAddress, Email anEmail, String orgName, Address orgAddress)

Given: The Name object memberName, the Address object address4, the Email object anEmail, the String "Yoga" and the Address object address6
- Check that no Member object with the supplied attributes exists (linked to any Schools or Organizations in the system)
 As the check suceeds:
- Check that an organization with name "Yoga" doesn_t exist linked to address6 (this check is not needed for this scenario , but is for the alternative scenario)
 As the check suceeds:
- A new Member object member62 is created with the supplied attributes
- A new Organization object organization3 is created with the supplied attributes
- letting records a reference to organization3
- organization3 records a reference to member62

If the Member already exists then throw an exception
If an Organization with the same name is linked to the same address object, throw an exception
Note: it is valid for the address objects for the member and organization to be the same
- 
private collection <School> school
- 
References a collection of all linked School objects 
- 
private collection <Organization> organizations
- 
References a collection of all linked Organization objects 
- public void addMemberAndOrganization(Name memberName, Address memberAddress, Email anEmail, String orgName, Address orgAddress)
- Postcondition: If a Member object exists in the system with the supplied attributes or if anOrganization with the same name is linked to the same address object, an exception is thrown, otherwise a new Member object, aMember, is created with the supplied attributes, and a new Organization object anObject is created with the supplied attributes. anOrganization records a reference to aMember.. The receiver records a reference to anOrganization
- 
public Boolean hasMember(Name aName, Address anAddress, Email anEmail) 
- 
Postcondition: returns True if the receivers members contains a Member with the supplied attributes 
- private Collection<Member> members
- 
Organization(String name, Address address, Member aMember) 
- 
Postcondition: initialises a new Organization object anOrganization with the given attribute values. A reference to anOrganization is returned 
- 
public Boolean hasMember(Name aName, Address anAddress, Email anEmail) 
- 
Postcondition: returns True if the receivers members contains a Member with the supplied attributes 
- none
- Member(Name aName, Address anAddress, Email anEmail)
 
- Post condition: a new Member object aMember is created. A reference to aMember is returned
- isMemberOf from Organization to Member
- worksAt from School to Member