Project 3

pdf

School

Dallas County Community College *

*We aren’t endorsed by this school

Course

1436

Subject

Information Systems

Date

Dec 6, 2023

Type

pdf

Pages

4

Uploaded by DrPencilCapybara24

Report
Copyright 2023 © Dallas College, All Rights Reserved. Page 1 of 4 Project Three: Hotel Occupancy In this Programming Project, you will study hotel occupancy by modelling a hotel’s behavior. Start by creating a C++ structure named Room which has the following members: string roomNumber Room identification int floorNumber Floor number int occupancy Number of people in this room int codeLimit Maximum number of occupants per fire code Your program will prompt the user to identify and process a text file that contains information defining the current state of a hotel. Your program will then prompt the user to identify and process a second text file that contains transactions that can potentially change the number of occupants in some of the rooms. Finally, your program will calculate the number of maids required based on the guest occupancy for each floor as well as determining if the hotel is operating profitably. Keep track of the number of occupied rooms at the hotel. The percentage of occupied rooms is referred to as the occupancy rate and is compared to the hotel’s break even occupancy rate to determine profitability. The text file that defines the current state of the hotel contains the following records: The first record in the file contains two fields: o the name of the hotel and o the break-even occupancy rate as a fraction (0.55 is 55%). Subsequent records define the rooms in the hotel and their current state of occupancy. Each record contains: o Room identification (room number) o Floor number o Current occupancy o Code limit This is a sample of the contents of the first file: Continental 0.45 2001 2 0 2 2002 2 2 2 3001 3 0 3 3003 3 2 3 Exec5 4 3 6
Copyright 2023 © Dallas College, All Rights Reserved. Page 2 of 4 The file defines the Continental Hotel, which has a break-even occupancy rate of 45%. This sample does not attempt to define the entire hotel. However, it serves to give you an idea of what the file will look like. Apply the following rules to ensure the integrity of the data in the first file: Room number can be anything. The floor number must be a positive value greater than zero. The code limit must be a positive value greater than zero. Occupancy must not be a negative value. The occupancy value must not exceed the code limit. If a rule is violated, report the violation by displaying a detailed message on the console. Your program should identify the type of violation and the room number associated with the violation. After processing the first file, display the following: The name of the hotel, the number of rooms in the hotel, and its break-even occupancy rate as a percentage value. The total number of rooms and the number of occupied rooms in the hotel as well as the current occupancy rate. The second file contains transactions that potentially change the occupancy of some of the rooms. Guests are either checking in or checking out. Records in the second file have the following format: Transaction code: Either “ CI ” for checking in, or “ CO ” for checking out. Room number Number of guests This is a sample of the contents of the second file: CI 2001 2 CI 2002 2 CO 3001 3 CO 3003 1 CX 1234 2 // Example of bad transaction code. CI 2001 3 // Room may already be full. In this sample, the first record identifies two people attempting to check into room 2001. The second record shows two other people attempting to check into room 2002. The third and fourth records identify people attempting to check out. The last two example records are errors that your program will detect and report as well as ignoring the transaction itself.
Copyright 2023 © Dallas College, All Rights Reserved. Page 3 of 4 Your program will apply the following rules to ensure the integrity of the hotel’s occupancy: The transaction code must be either “ CO ” or “ CI ”. The room number must be valid. That is, the room number must have already been defined for this hotel. Checking in cannot increase the occupancy of a room beyond the code limit for that room. Checking out cannot reduce the occupancy of a room to a negative number. Again, if a rule is violated, report the violation by displaying a detailed message on the console. Your program should identify the type of violation and the room number associated with the violation as well as the number of guests involved. The number of guests staying on each floor is used to calculate the number of maids that will be required. If there are no guests on a particular floor, there is no need for a maid on that floor. If there are guests staying on a floor, there must be one maid for every six guests or a portion of six guests. For example, if ten people are staying on the third floor, two maids will be required for that floor. Even if there is only person staying on the floor, a maid is required for that floor. Compare the actual occupancy rate with the break-even rate to determine if the hotel is operating at a profit. Here is some example output using the sample files available to you on our course in Brightspace: Identify the file containing the hotel definition: hotel.txt Invalid floor number, 0, for room 2009 Invalid code limit, 0, for room 2008 Invalid occupancy, -1, for room 2007 Invalid occupancy, 3, cannot exceed limit, 2, for room 2006 The hotel Continental has 10 rooms, break-even rate is 45.0%. There are 4 occupied rooms with an occupancy rate of 40.0%. Hotel Continental is not profitable. Identify the file containing guest transactions: guests.txt Invalid attempt to check in 2 guests into room 2002. The code limit for room 2002 is 2. There are already 2 guests in that room. Invalid attempt to check 3 guests out of room 2001. There are only 2 people in that room.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Copyright 2023 © Dallas College, All Rights Reserved. Page 4 of 4 Invalid transaction code, CX, in record 7 Invalid room number, 9999, in record 8 There are 14 guests creating a requirement for 3 maids. The Occupancy rate is 80.0%. Hotel Continental is profitable. To receive full credit for this programming assignment, your submission must: Use a correctly formed file name. (Submit a file named “ XYProjectThree.txt ”, where “ X ” and “ Y ” are your first and last initials.) Submit a program that compiles and executes correctly. Interact effectively with the user in your prompts and messages. Grading Guideline: Include a comment containing the student’s full name. (5 points) Document the program with other meaningful comments. (5 points) Prompt the user to identify the file containing the initial definition of the rooms and guests in the hotel. (5 points) Read and process correctly the file containing the initial definition of the hotel. (10 points) Identify and display any errors in the records in the first file. (10 points) Display the name of the hotel and its break-even occupancy rate as a percentage. (5 points) Display the number of rooms and the number of guests created by processing the first file. (10 points) Prompt the user to identify the file containing guest transactions. (5 points) Read and process correctly the file containing hotel guest transactions. (10 points) Identify and display any errors in the records in the second file. (10 points) Display the number of guests and the number of maids required after processing the second file. (10 points) Display the occupancy rate and whether or not the hotel is profitable. (10 points) Use prompts and messages that are easy to understand. (5 points)