uc 09 - yshehab/SchoolRoomBooking GitHub Wiki
public void createAccount(Permit aPermit)
Given: The Permit object permit7
- Check there is not already an account object associated with permit7
As the check succeeds:
- Create a new variable chargeTotal
- Access the collection of Booking objects linked to permit7, which is in this case booking42 and booking 84
For each of the booking objects accessed in step 2, increment chargeTotal by the value of it_s cost attribute. - Check the value of chargeTotal is greater than 0
As the check succeeds:
- A new Account object, account68 is created with chargeTotal as it_s cost attribute.
- If aPermit is linked to a charge object throw an exception
- If totalCharge # 0, throw an exception
public BigDecimal getCost()
Post condition: Returns the receiver_s cost
private collection<Booking> bookings
public void createAccount()
Post condition: a new Account object is created with it_s cost attribute the sum of the cost attributes of all the receivers linked Booking objects
If the receiver has a linked Account object then an exception is thrown.
If the sum of the cost attributes of all the receivers linked Booking objects # 0, then an exception is thrown.
None
public void createAccount(Permit aPermit)
Post condition: a new Account object is created with it_s cost attribute the sum of the cost attributes of all the Booking objects linked to aPermit.
If the aPermit has a linked Account object then an exception is thrown.
If the sum of the cost attributes of aPermits linked Booking objects # 0, then an exception is thrown.
consistsOf from Permit to Booking