hotel-contract - repair_rooms LIST[ROOMS List of all the...

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
exercise-in-contracts Page 1 You are given the following defined class ROOM with the only features you need for this problem. class ROOM feature {ANY} status : STATUS -- One of reserved , unreserved , occupied , repair guest : GUEST -- Only for HOTEL void unless occupied or reserved . end Write require, ensure and class invariant assertions for the following methods of a class HOTEL that represents rooms and guests at a hotel. The minimum size of a hotel is 100 rooms. Write your assertions in as formal a mathematical notation as possible. Your assertions do not have to be executable. class HOTEL create make feature avail_rooms : LIST[ROOMS] -- List of all the rooms not under repair -- available for use
Image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: repair_rooms : LIST[ROOMS] -- List of all the rooms under repair capacity : INTEGER -- Number of rooms in the hotel make (size : INTEGER) -- Build a new hotel with size rooms where all rooms are available. require ensure vacancy : BOOLEAN -- Returns true if and only if there is an unreserved room. require ensure unreserved_check_in (guest : GUEST) -- The guest has not made a reservation. Puts the guest into an unreserved room. require ensure remove_room_for_repair (room : ROOM) -- Moves an unoccupied room from the available list to the repair list. require ensure vacancy_count : INTEGER -- Returns the number of unreserved rooms. require ensure invariant end...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern