Task 1. Array Version.

Design a program for a hotel with eight rooms using code similar to the code given in your notes. Start by checking that the code works.

Once the basic code runs, put the code that 'Views All rooms' and Adds customer to room, into separate procedures, and test it works. You can build up your test cases as you develop your program (see testing below).

Then add a menu system which will allow the user to choose what they want to select. Enter an 'A' to add a customer to a room, and a V to view all rooms. Implement each as a method. When an A is pressed, it should do the Add method; a V should do the View method.

One by one, add extra methods to do each of the following. The user should be able to choose from the menu what the program does.

E: Display Empty rooms
D: Delete customer from room
F: Find room from customer name
S: Store program data into file
L: Load program data from file
O: View guests Ordered alphabetically by name. (Do not use library sort routine)

Task 2. Classes Version.

Create a second version of the Hotel program using an array of Room objects. Create a class called Hotel and another class called Room. The program should function as in Task 1.

Task 3.

Extend your programs from Task 1 and Task2. Modify both programs so that each room can now hold the following additional information. (Hint: you will need a Person class for the class version)

  • The number of guests in a room.
  • Additional information for the paying guest.
    • First Name.
    • Surname.
    • Credit Card number.

(This task will familiarise you with what we mean by "maintainability" of a program. If you don't use classes, you will need to use parallel arrays! While you are doing this task think about which of the programs was easier to extend and why)

Task 4. Queue version.

Add a waiting list to your Hotel class version. Modify your 'A: Add' and D: Delete as follows:

  • When you press 'A' to add a new customer, if the hotel is full, the customer should be added to a Waiting List (a queue).
  • When you press 'D' to delete a customer from a room, the next customer in the waiting queue should be automatically placed in the room.
  • Extra marks will be awarded if you implement the waiting list as a circular queue.

Tsak 5. Testing.

Create a table of test cases showing how you tested your program. Write a brief (no more than one page) discussion of how you chose your test cases to ensure that your tests cover all aspects of your program.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.