Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write a code for this in c++ Implement a static queue that can be used to queue information for a Vacation Rental for the

Please write a code for this in c++

Implement a static queue that can be used to queue information for a Vacation Rental for the month of December (31 days).

The queue stores requests for the rental that are filled on a first-come, first-served basis.

Each request includes the following information. string name; // may include spaces int start_day; int num_days; Name your queue class Reservations.

Make a Request structure in the private section of your queue class with a field for each piece of information. Your queue class (Reservations) must contain an array of Request structures that is allocated in the constructor (static Queue implementation). Use a queue size of 5.

Pass the queue size into the constructor. For this program, you can add or modify the queue methods (functions). Generally code that is working with the elements in the queue (reservations) should be in the queue class. Code that is requesting something from the queue should be with main and its functions (rental status). Your program must have an array of 31 elements to contain the rentals status for each of the days in December. Each array element is a struct that includes a string for the name and enum for the status: {Available, Booked, Not Available}. Declare this structure in the file that holds your main program. Initialize the array with the 23rd through the 27th marked unavailable as the owner will be using the rental at that time. Set the name field for these days to Owner. Your program should display a menu that allows a user to 1. Add a request 2. Process the next request 3. Print the Queue 4. Print the rentals status for the days in the month 5. Exit Your program must process menu selections until the user chooses to quit. The Add a request option should read the name, start day, and num days from the user, validate start day and num days to make sure that they stay with the range 1 to 31. If the queue is full, print a message to the user telling them to try again later. The Process next request option should remove an item from the queue, update the status of the days requested if the entire timespan requested is available by marking the status as booked and copying the name into the name field for the array of structures. Then, print a message saying whether the reservation was accepted or denied. If denied, display which days requested were not available.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Demystified

Authors: Andrew Oppel

1st Edition

0072253649, 9780072253641

More Books

Students also viewed these Databases questions