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

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use 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);

By purchasing this solution you'll be able to access the following files:

for this solution

or FREE if you
register a new account!

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.

Upload a file
Continue without uploading

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