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 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
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;
return (reservation != NULL);

This is only a preview of the solution. Please use the purchase button to see the entire solution

Assisting Tutor

Related Homework Solutions

Get help from a qualified tutor
Live Chats