QuestionQuestion

Design a program to keep track of a restaurants waitlist using a queue implemented with a linked list.

1. Create a class named waitList that can store a name and number of guests. Use constructors to automatically initialize the member variables.

2. Add the following operations to your program:
a. Return the first person in the queue
b. Return the last person in the queue
c. Add a person to the queue
d. Delete a person from the queue
3. Create a main program to test your class. Your main program should contain the following options.
a. Add a guest (adds the reservation name and number of guests)
b.Delete a guest (the user must give you the name to delete, the list may be empty or the guest may not be in the list)
c. Show last guest waiting (return NONE if the queue is empty)
d. Show first guest waiting (return NONE if the queue is empty)
e. Exit

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

// queue.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
#include <string>

using namespace std;

class waitList
{
public:
string name;
int numberOfGuests;
waitList* next;
waitList(string n, int nog):name(n), numberOfGuests(nog)
{
next = NULL;
}
};

bool SearchwaitList(waitList* head, string name) // Returns boolean as it is used to check if the new contact alreadz exist
{
waitList* reservation;
int i = 1;
reservation = head;
while ((reservation != NULL) && (reservation->name != name))
{
reservation = reservation->next;
i++;
}
return (reservation != NULL);
}...
$13.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats