Write pseudocode for dependency checks and merge procedures (as used in Bayou) suitable for a simple room-booking application.
What will be an ideal response?
```
Operation: room.book(booking).
let timeSlot = booking.getPreferredTimeSlot();
Dependency check:
existingBooking = room.getBooking(timeSlot);
if (existingBooking != null) return “conflict” else return “no conflict”;
Merge procedure:
existingBooking = room.getBooking(timeSlot);
// Choose the booking that should take precedence over the other if (greatestPriority(existingBooking, booking) == booking)
then { room.setBooking(timeSlot, booking); existingBooking.setStatus(“failed”);}
else {booking.setStatus(“failed”);}
```
– in a more sophisticated version of this scheme, bookings have alternative time slots. When a booking cannot be made at the preferred time slot, the merge procedure runs through the alternative time slots and only reports failure if none is available. Similarly, alternative rooms could be tried.
You might also like to view...
Which command below runs TestProgram, and passes in the values files.txt and 3?
a. java TestProgram files.txt 3. b. java TestProgram files.txt, 3. c. java TestProgram "files.txt", "3". d. None of the above.
How many adjectives (including articles) and adverbs appear in the following quote from the Dead Poets Society?Carpe diem. Seize the day, boys. Make your lives extraordinary.?
A. ?2 B. ?3 C. ?4 D. ?5
Changing one shape in a SmartArt graphic changes all of the shapes.
Answer the following statement true (T) or false (F)
A single HTML element is limited to ____ attributes.
A. 24 B. 48 C. 96 D. There is no limit.