Question

In: Computer Science

//C++// Problem Statement: Have you been to a popular restaurant recently? Many are using cell phones...

//C++//

Problem Statement:

Have you been to a popular restaurant recently? Many are using cell phones to notify groups when their table is ready. But, why not an App? It could let groups know their place in line and be a sales tool for the restaurant to forward coupons and other promotions to increase business.

Let’s say you had a friend opening up a new restaurant business and they are looking for help with the software support. They have asked you to be part of the project. You have decided that a queue would be a great ADT for keeping track of who is in line, and how long it will take before they get a table. You have also decided that a stack would be great for reaching out to the customers who most recently frequented the restaurant to provide promotional materials so that they will return before forgetting about this great new restaurant.

Programming: There are two ADTs in this program (Queue and Stack ADT).

  1. The queue will represent the people in line waiting for a table.
  1. The queue is ordered based on the order in which the groups arrive. The data should include

(a) name of the group,

(b) number of people in the group

(c) if there is anyone who needs special seating

If so, include the information about any requirements (e.g., wheel chair or high chair).

(e) if the group would like to receive coupons and other promotional materials

If so, include the contact name (full name) and email address

  1. The stack then will represent people interested in receiving promotional material, which should include their full name and email address

  • Please keep in mind that because we are creating ADTs, the user of the program must not be aware that stacks and queues are being used. You should support complete implementations of the Stack and Queue ADT. Make sure to thoroughly test each of the stack and queue functions!

Programming – Data Structures:

  • The queue should be implemented using a circular linked list of people, where the rear pointer points to the most recent group to arrive at the restaurant, and rear->next points to the first group to arrive that hasn’t yet been seated. You must implement enqueue, dequeue, peek, and display. Enqueue would be used when people arrive. Dequeue would be used when groups get seated. Display should include the number in line, so people will know how long of a wait they have.
  • The stack should be implemented using an array, where each element in the array is a person interested in promotional materials. The array must be dynamically allocated. Have the constructor receive the size of the array from the client program. Stack ADT functions should include push, pop, peek, and display. When a group gets seated at a table, it is time to push their information onto the stack if they are interested in promotional materials.

Then, when the manager will contact those people using pop when there are a few new promotional events (e.g., a pumpkin carving party). As you know, using a stack will allow the manager to contact the most recent people who have frequented the restaurant. The manager doesn’t want to entirely lose this information, so they would like it saved in an external data file after being removed from the stack.

Things you should know...as part of your program:

  1. Do not use statically allocated arrays in your classes or structures used by the ADT.
  2. All data members in a class must be private
  3. Never perform input operations from your data structure class
  4. Global variables are not allowed
  5. Do not use the String class! (use arrays of characters instead!) You may use the cstring library.
  6. Use modular design, separating the .h files from the .cpp files. Remember, .h files should contain the class header and any necessary prototypes. The .cpp files should contain function definitions. Never "#include" .cpp files!

Solutions

Expert Solution

#include"Header.h"
string Name;
string namess;
string nameInTabels ;
string name2 ;
int counter=0;
customer::customer()
{
name = "";
gsize = status = 0;
next = NULL;
}
customer::customer(string name1, int gsize1, int status1)
{
name = name1;
gsize = gsize1;
status = status1;
next = NULL;
}
waitinglist::waitinglist()
{
chairnum =50 ;
totalcustomers = tables = 0;
head = tail = NULL;
}
waitinglist::waitinglist(int val)
{
chairnum = 50;
totalcustomers = 0;
tables = 0;
head = tail = NULL;
}
void waitinglist::change()
{
customer*temp ;
temp = head;
cout << "Enter the name: ";
cin >> namess;
while (temp != NULL)
{
if (namess == temp->name)
{
if (temp->status==2)
{
temp->status=1;
cout << "Your changes have been successfully saved!" << endl ;
break ;
}
else
{
temp->status=1;
cout << "Your changes can't saved!" << endl ;
break ;
}
}
else if (namess != temp->name)
{
temp = temp->next;
}
}
if (temp == NULL)
{
cout << "Can't found! " << endl;
}
}
void waitinglist::whobefore()
{
string nam;
customer*tmp;
tmp = head;
cout<<"Enter the name: ";
cin>>nam;
customer*tmpo;
tmpo = head;
bool x=true;
while (tmpo != NULL)
{
if (nam == tmpo->name)
{
x=true;
break;
}
else if (nam != tmpo->name)
{
tmpo = tmpo->next;
}
}
if (tmpo == NULL)
{
x=false;
}
if (tmp->name == nam)
{
cout<<"None Before You!"<<endl;
}
else if(x==true)
{
do
{
cout<<"the name: "<<tmp->name<<endl;
tmp = tmp->next;
} while (tmp->name!=nam);
}
else if (x==false)
{
cout<<"The name doesn't Exist!"<<endl;
}
}
void waitinglist::diplayonstatus()
{
int status,c=0;
customer*tmp;
tmp = head;
cout<<"Enter the status: ";
cin>>status;
if (status!=1 && status!=2)
{
cout<<"Please enter correct status!\n"<<endl;
}
else
{
if (tmp == NULL)
{
cout<<"Empty!"<<endl;
}
else
{
do
{
if (tmp->status == status)
{
cout<<"The name: "<<tmp->name<<endl;
cout<<"The number of Group: "<<tmp->gsize<<endl;
tmp = tmp->next;
c++;
}
else
{
tmp=tmp->next;
}
}while (tmp->next!=NULL);
if (tmp->status == status)
{
cout<<"The name: "<<tmp->name<<endl;
cout<<"The number of Group: "<<tmp->gsize<<endl;
tmp = tmp->next;
c++;
}
else
{
tmp=tmp->next;
}
cout<<"Total Customers in this list: "<<c<<endl;
}
}
}
void waitinglist::newcustomer()
{
customer*tmp = new customer;
cout << "Enter the name: "; cin >> tmp->name;
customer*tmpo=new customer;
tmpo=head ;
while (tmpo != NULL)
{
if (tmp->name != tmpo->name)
{
tmpo = tmpo->next;
}
else if (tmp->name == tmpo->name)
{
cout<<"The name already exist!\n " << endl ;
cout <<"Enter the name: "; cin >> tmp->name;
tmpo=head;
}
}
cout << "Enter The Number of members: "; cin >> tmp->gsize;
cout << "Enter the status: "; cin >> tmp->status;
while (tmp->status!=1 && tmp->status!=2)
{
cout<<"Please enter correct Status! \n";
cout << "Enter the status: "; cin >> tmp->status;
}
if (head == NULL) // linkedlist is empty
{
head = tail = tmp;
totalcustomers++;
}
else
{
tail->next = tmp;
tail=tail->next;
totalcustomers++;
}
}
void waitinglist::removecustomer(string name1) // IMPREFECTION ---- INCOMPLETE
{
customer *tmpo, *tmp;
tmpo = head;
tmp = tmpo->next;
if (tmpo == NULL)
{
cout << "Can't found!" << endl;
}
else if (tmpo->name == name1)
{
head=tmpo->next;
cout << "Your changes have been successfully saved!" << endl ;
delete tmpo;
}
else{
do
{
if (name1 == tmp->name)
{
tmpo->next=tmp->next;
delete tmp;
cout << "Your changes have been successfully saved!" << endl ;
break;
}
else if (name1 != tmp->name)
{
tmp = tmp->next;
tmpo = tmpo->next;
}
}
while (tmp != NULL);
}
}
void waitinglist::checktables()
{
float c=5.00; // Number of chairs
customer*temp=head;
cout << "Enter the available tables: ";
cin>>tables;
while (tables>=1 && temp!=NULL)
{
int x;
float y;
y=((temp->gsize)/c);
x=(temp->gsize)/c;
if (tables<y)
{
temp=temp->next;
}
else if (tables>=y)
{
if (x==y)
{
tables=tables-x ; // Correct Table!
cout<<"The name is: ";
cout<<temp->name<<endl;
nameInTabels=temp->name ;
removecustomer(temp->name);
break ;
}
else if (x!=y)
{
tables=tables-(x+1);
cout<<temp->name<<endl;
removecustomer(temp->name);
break ;
}
}
}
if (temp==NULL)
{
cout << "Empty!" << endl ;
}
}
void waitinglist::displayall()
{
int c=0;
customer *tmp;
tmp = head;
if (tmp == NULL)
{
cout << "Empty!";
}
while (tmp != NULL)
{
cout << "The Name: " << tmp->name <<endl;
cout << "The Number of members: " << tmp->gsize << endl;
cout << "The status: " << tmp->status<<endl;
c++;
tmp = tmp->next;
}
cout<<"Total Customers: "<<c<<endl;
cout << endl;
}
void waitinglist::diplaycustomer()
{
customer*tmp;
tmp = head;
cout << "Enter the name: ";
cin >> Name;
while (tmp != NULL)
{
if (Name == tmp->name)
{
cout << "The name: " << tmp->name << endl;
cout << "The Number of members : " << tmp->gsize << endl;
cout << "The status: " << tmp->status << endl;
break;
}
else if (Name != tmp->name)
{
tmp = tmp->next;
}
}
if (tmp == NULL)
{
cout << "Can't found!" << endl;
}
}
int main()
{
int choice;
string name1 = "";
int gsize1 = 0;
int status1 = 0;
waitinglist mylist;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 10 );
cout<<"----------------------------------------------------------\n";
cout<<"-> Project Restaurant Waiting List <-\n";
cout<<"-> ******************************* <-\n";
cout<<"----------------------------------------------------------\n"<<endl;
cout << "Note in status:"<<endl<<"1 --> the customer is here."<<endl<<"2 --> the customer not here.\n\n";
cout << "Select your option. \n";
cout << "------------------- \n";
cout << "(1) Add a new Customer. \n";
cout << "(2) Display information based on Name. \n";
cout << "(3) List all Names. \n";
cout << "(4) Change the status. \n";
cout << "(5) Check tables by name. \n";
cout << "(6) Display the List Based on the status. \n";
cout << "(7) Who is before? based on name. \n";
cout << "(8) Remove Customer Based on name. \n";
cout << "(9) Exit. \n";
do
{
cout << "\n";
cout << "Enter your choice --> ";
cin >> choice;
if (1 <= choice && choice <= 8)
{
switch (choice)
{
case 1:
mylist.newcustomer();
break;
case 2:
mylist.diplaycustomer();
break;
case 3:
mylist.displayall();
break;
case 4:
mylist.change() ;
break;
case 5 :
mylist.checktables();
break;
case 6:
mylist.diplayonstatus();
break;
case 7:
mylist.whobefore();
break;
case 8:
cout<<"Enter the name: ";
cin>>name2;
mylist.removecustomer(name2);
break;
default:
cout << "Invalid choice. \n\n";
break;
}
}
else
{
cout << "Invalid choice. \n\n";
}
}while (choice != 9);
system("pause");
return 0;
}

Related Solutions

Gino’s Restaurant is a popular restaurant in Boston, Massachusetts. The owner of the restaurant has been...
Gino’s Restaurant is a popular restaurant in Boston, Massachusetts. The owner of the restaurant has been trying to better understand costs at the restaurant and has hired a student intern to conduct an activity-based costing study. The intern, in consultation with the owner, identified the following major activities: Activity Cost Pool Activity Measure Serving a party of diners Number of parties served Serving a diner Number of diners served Serving drinks Number of drinks ordered A group of diners who...
Gino’s Restaurant is a popular restaurant in Boston, Massachusetts. The owner of the restaurant has been...
Gino’s Restaurant is a popular restaurant in Boston, Massachusetts. The owner of the restaurant has been trying to better understand costs at the restaurant and has hired a student intern to conduct an activity-based costing study. The intern, in consultation with the owner, identified the following major activities: Activity Cost Pool Activity Measure Serving a party of diners Number of parties served Serving a diner Number of diners served Serving drinks Number of drinks ordered A group of diners who...
Complete a essay to answer the following statement. Thank you!. THE INTRODUCTION OF CELL PHONES AND...
Complete a essay to answer the following statement. Thank you!. THE INTRODUCTION OF CELL PHONES AND THE BIAS IN THE CPI
You have recently been elected president of the United States. One of your most popular positions...
You have recently been elected president of the United States. One of your most popular positions is that you want to reduce the costs of doing business in the United States. When asked how you intend to accomplish this, you reply, ‘‘By seeking to repeal all laws that create unnecessary costs. Repealing such laws will be good not only for business but also for the consumer since product costs, and therefore selling prices, will be reduced.’’ Congress heard the message...
You have recently been promoted to district manager of a large scale restaurant chain which specializes...
You have recently been promoted to district manager of a large scale restaurant chain which specializes in affordable meals in a pleasant environment. In accordance with management objectives, you are responsible for increasing sales of appetizers by 20 percent by the next quarter for the 15 locations in your area. Keeping channel richness in mind, how will you make contact with the restaurant employees to facilitate the sales increase? Organizational Behavior
You have been asked by an investor to value a restaurant using discounted cash flow valuation....
You have been asked by an investor to value a restaurant using discounted cash flow valuation. For the current year, the restaurant earned pretax operating income of $750,000. Income has grown 2% annually during the last five years, and is expected to continue growing at that rate for the next two years. Net operating working capital increased by $60,000 during the current year and current year capital spending on long-lived assets exceeded depreciation by $75,000. Both working capital and the...
Recall that the Cell Phones & Stuff server will provide many services and roles. These services...
Recall that the Cell Phones & Stuff server will provide many services and roles. These services include Active Directory, DNS, DHCP, FTP, print services, and email. You have decided to use virtualization in your implementation. How will you implement the services within the virtual realm? Please address the following questions and be sure to provide justifications for your decisions: How do you plan to create, configure, and manage virtual machines (VMs) for the company? What services will those VMs offer?...
What types of mobile phones have you ever used? Have you been marketed to before on...
What types of mobile phones have you ever used? Have you been marketed to before on these phone(s)? If so, how? If not, what do you think would work effectively? Comment of a classmate's post. Post a link to your favorite phone.
I have been getting many incorrect answers recently, if you are unsure please do not attempt....
I have been getting many incorrect answers recently, if you are unsure please do not attempt. All i ask is all parts answered and with shown or explained work. Thank you (: The following data represent the math SAT scores for a random sample of seniors from three different high schools. School A School B School C 488 445 618 592 370 525 537 382 651 470 423 647 539 523 543 Using α=0.05, perform a hypothesis test to determine...
I have been getting many incorrect answers recently, if you are unsure please do not attempt....
I have been getting many incorrect answers recently, if you are unsure please do not attempt. All i ask is all parts answered and with shown or explained work. Thank you (: Delaware National Golf Club went out of business during the recent downturn in the economy (a sad day in the Donnelly household). Susan is a real estate developer who would like to build houses on a portion of it. To do so Susan will need the approval of...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT