Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Please write 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

Add a request

Process the next request

Print the Queue

Print the rentals status for the days in the month

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.

Design your program, including the items listed on the CSC 300 Program Design Documentation Requirements. Be sure to include the complete declarations for your classes and pseudo-code for your class methods.

Save the design in a file named RentalResDesign_xxx.doc where xxx are your initials. Submit your program design in the Program 3 Design drop box by the due date shown in the calendar and drop box tools.

Write your classes and main program. Use a separate .h and .cpp file for each class. You also need a separate .cpp file for your main program.

Compile, run and test your classes and program.

Update your design if necessary. Submit your final design document and working .cpp and .h files in the Program 3 drop box by the due date shown in the calendar and drop box tools. Do not zip your files. Submit them separately.

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

Filing And Computer Database Projects

Authors: Jeffrey Stewart

2nd Edition

007822781X, 9780078227813

More Books

Students also viewed these Databases questions

Question

Can a decision problem have more than one dependent variable?

Answered: 1 week ago