uc 19 v2 - yshehab/SchoolRoomBooking GitHub Wiki

19. Add a room to a school. Version 2

TO DO - revise

Coordinating method

public void addRoom(School aSchool, String aName, Collection<Assets> assets, int capacity, Roomtype roomtype)

Object diagram for a typical scenario.

Walk-through for this scenario

Given: The School object school2, name Large Gym, assets theAssets, capacity 60 and roomtype GYM)

  1. Access the collection of Room objects linked to school2, in this case room7 and room3.
    For each of these Room objects
  2. find out it_ s RoomType
  3. if it is GYM, find out it_s name
  4. check it_s name is not "Large Gym".
    As neither Room has the same type and name:
  5. Create room12, a new Room object, with the supplied attribute values and assets according to the supplied collection.
  6. school2 records a reference to room12

Sequence diagram for this scenario

Notes on alternative scenario

If a Room object linked to the school has a Room with the same type and name throw an exception.

Updates to implementation model

Classes

Class LettingCoord

Links
Collection<School> schools`
Methods
public void addRoom(School aSchool, String aName, Collection<Assets> assets,  int capacity,  Roomtype roomtype)` 

Class School

Links
Collection<Room> Rooms
Methods
public void addRoom(String aName, Collection<Assets> assets,  int capacity,  Roomtype roomtype)

Class Room

Links
Collection<Asset> assets
Methods
public RoomType getType()

public String getName()

new Room(String aName, Collection<Assets> assets,  int capacity,  Roomtype roomtype)

Navigations

School to Room

Discussion

NOTE: I have included a check in the scenario to avoid duplication of room names for rooms of the same type. This seems to make sense to me to avoid confusion when booking rooms. - ben

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