...
This slice of the software
- remembers who has been accommodated in which room
- keeps track of consumption of beverages (beer and soda)
Each week and each occupied room is represented by an instance of
AccommodationInfo
in the repository and stores the name of the guest (assumed
to be unique) and the room number where he or she has been
accommodated for the week. Consumption is reported every morning
by the cleaning lady, who also refills the fridge in the room.
...
IsRoomFree
has a twist, because it must make sure
- that there is no reservation for the room and the current week
(after all, it might be waiting for being claimed by the reserving party
AND
- that the room is not occupied by another guest already (this part is handled by the method
IsRoomFreeOfAccommodation
)
(An alternative implementation would set and clear
the corresponding reservation info for the current week
whenever someone is accommodated.)
...
The analogous operations to Reserve
and Cancel
are
Accommodate
and CheckOut
. Accommodate
giveth, CheckOut
taketh,
just like Reserve
and Cancel
. More deja-vus:
Accommodate
throws an exception if no rooms are availableAccommodate
throws an exception if the name for accommodation already is in the repositoryCheckOut
throws an exception if the cancelee can't be found in the repository
Apart from that, CheckOut
returns an amount of money as decimal
,
i.e. the Total
as computed by the Bill
.