Académique Documents
Professionnel Documents
Culture Documents
1.0
INTRODUCTION
1.1
Project Synopsis
Every afternoon the public makes their way to their favorite Tim Hortons, and they order a coffee just the way they like it, or even ask to get their favorite sandwich made. Sound like a very calm and relaxing process you may think, but in the world of discrete simulation, our customers and servers become busy little transactions moving from one block to the next. Tim Hortons system model consists of customers coming to the restaurant. The customers arriving into the shop to make the orders. They line up in a single queue and are helped by one server. At that point, customers may just order a beverage of their choice, baked good, sandwich or soup. They will complete their interaction as soon as they pay for their purchase and receive their beverage and/or baked good, if applicable. The applications of data structure in Tim Hortons Restaurant are describe as following: 1. This system applies queue using array implementation in our system to generate Tim Hortons model. 2. Single queue is applied in the restaurant of single based server. 3. When customers arrive, they will follow the rule of FIFO(First In First Out) First customer is served with display menu. After the choice is made, the server will ask for another order or not. If yes, customer makes another order. Total price is calculated based on the choice of customer. After customer exit the system, the corresponding order will be entered into the Display Order Function. Another customer from the queue will enter the system and the whole procedure will be looped again. And each time customer exit the system, new data will be entered to Display Order Function. Total of orders from all different customers will be consummated into the Total Number of Orders Function. As the system applies FIFO rule, each time the order is deleted from Display Order Function, the first customers order will be deleted first. Finally, the system will be exited and each data stored will be shown in the Output File.
1.2
Objective
The following are the objectives of Tim Hortons System: 1. To list down all the order from the customers. 2. To list down all the time of order. 3. To display the entire customers order. 4. To make the delete function into the system.
To make the system that matches all the objectives, the analysis and design of the system must be done first.
2.0
2.1
System Requirements
Start
Customers Info
Display Menu
Enter Order
Addition Order
Ye s
No
Total Cost
End
Show Price
Server
Customers
3.0
SYSTEM PROTOTYPE
Welcome To Tim Horton Restaurant Menu: 1. Order the menu 2. Time Of Order 3. Display All The Orders 4. Delete The Order 5. Exit Enter 1, 2, 3, 4 or 5 To Continue.......
This page will be the first page. It will display all the function for this system.
Welcome To Tim Horton Restaurant Menu: 1 (Order The Menu) 1. Baverage 2. Baked Goods 3. Sandwich 4. Soup Enter 1, 2, 3 or 4 To Continue....... Enter M or m to retun to main menu
This page shows the menu prepared by Tim Horton Restaurant for the customers to make their order.
Welcome To Tim Horton Restaurant Menu: 2 (Time Of Order) Enter The Time Of The Order: The Time Of Order Is: Enter M or m to retun to main menu
At this page, the server needs to insert the time of the order to be inserted in the queue.
Welcome To Tim Horton Restaurant Menu: 3 (Display All The Orders) Order No Time
This page will display all the order inserted by the server.
Welcome To Tim Horton Restaurant Menu: 4 (Delete The Order) This function will delete the order at the top of the list in the order display Order To delete... Order No Time
This page will do the delete function. The order that will be deleted is the order at the top of the list in the display order function. Only one order will be deleted at one time.
4.0
SYSTEM TESTING
Figure 2 show the first page of the system. The server can choose the menu in the screen for the function like add an order. Delete the order, display all the order in the queue, count the number of order and to exit the system.
Figure 3 shows the order made by to the server. First, the time of order need to be inserted with the name of the customers. The customers will choose the menu as displayed in the screen with the quantity. Then the system will count the total of all the goods and display it.
Figure 4 shows all the order made by all the customers. It display the time of the order, order number, name of the customer and total cost of the order.
Figure 6 shows the delete process in the system. It will delete the first data or order inserted to the system. The data that is deleted are displayed on the screen.
Figure 7 shows all the order that left in the system database after the delete process is done.
5.0
DEVELOPMENT ACTIVITIES
Table 1 below shows the activities that have been done in development of this system.
Meeting Date Members Participate in the meeting Activity Task for each member Task Achieved (yes/No)
8 April 2009
Mohd Haniff Mohd Fadhil Kamalraj Mohd Haniff Mohd Fadhil Kamalraj
Make the analysis to the question Give work to each group members.
All group members give their opinion Kamalraj and Haniff make all about the coding and Fadhil make the report.
Yes
10 April 2009
Yes
15 April 2009
Yes
Table 1
6.0
APPENDIX
13 Tim Hortons Restaurant #include #include #include #include #include #include <fstream.h> <stdio.h> <string.h> <conio.h> <ctype.h> <iomanip.h>
class orders { private: struct orderrec { char time[30]; char orderno[10]; char name[30]; char cost[30]; struct orderrec* next; }; orderrec *in, *out,*temp, *next1; public: int numrecord; void enque (char *time, char *orderno, char *name, char *cost); void serve (char *time, char *orderno, char *name, char *cost, int *numrecord); void display (char *time, char *orderno, char *name, char *cost); void show (char *time, char *orderno, char *name, char *cost, int *numrecord); orders() { in = NULL; out = NULL; } int empty() { return (out == NULL); } }; void orders::enque(char* time, char* orderno, char* name, char *cost) { orderrec *order; order = new orderrec; if (order == 0) { cout << "\n\t Invalid! \n"; } else {
14 Tim Hortons Restaurant if (out == NULL) { out = order; } if (in != NULL) { in ->next = order; } strcpy (order->time,time); strcpy (order->orderno,orderno); strcpy (order->name,name); strcpy (order->cost,cost); order->next = NULL; in = order; } } void orders::serve(char* time, char* orderno, char* name, char* cost, int* numrecord) { orderrec* next; int record; record = *numrecord; strcpy (time,out->time); strcpy (orderno,out->orderno); strcpy (name,out->name); strcpy (cost,out->cost); next = out->next; delete out; out = next; record = (record - 1); *numrecord = record; }; void orders::show(char* time, char* orderno, char* name, char* cost,int* numrecord) { orders order; orderrec* next; orderrec* temp; orderrec* next1; int num,records; records = *numrecord; temp = out; for (num =1;num <=records; num++) { strcpy (time,temp->time); strcpy (orderno,temp->orderno); strcpy (name,temp->name); strcpy (cost,temp->cost);
next1 = temp->next; temp = next1; order.display (time, orderno, name, cost); } }; void orders::display(char* time, char* orderno, char* name, char* cost) { cout<<"\n\tTIME \t ORDER NUMBER \t NAME \t COST \n"; cout<<"\t========================================== ======================\n"; cout << "\t" << time << "\t\t" << orderno << "\t" << name << "\t" << cost << endl; };
void main(void) { char choice; char time[30]; char orderno[30]; char name[30]; char cost[30]; int index=0,numrecord=0; orders order; fstream infile; infile.open("FastFood.dat",ios::in); while(infile >> time >> orderno >> name >> cost) { order.enque(time, orderno, name, cost); numrecord = numrecord +1; } infile.close(); cout << "\n\t WELCOME TO TIM HORTON'S RESTAURANT \n"; cout << "\n\t Press any key to continue.." << endl; getch(); do { clrscr(); cout << "\t +=========================+ \n"; cout << "\t | TIM HORTON'S RESTAURANT |" << endl; cout << "\t +=========================+ \n"; cout <<"\n\t 1. ADD an order \n"; cout <<"\n\t 2. DELETE an order \n";
16 Tim Hortons Restaurant cout <<"\n\t 3. DISPLAY all orders\n"; cout <<"\n\t 4. COUNT No of Records: \n"; cout <<"\n\t 5. EXIT \n"; cout <<"\n\t ENTER selection [1 - 5] from Menu: "; cin >>choice; while (isalpha(choice)) { cout <<"\n\t Please enter a number from 1 -4 "; cin >>choice; } while (cin.get() != '\n'); switch (choice) { case '1': do { clrscr(); char pilihan, teruskan; char cost1[30]; int num, price, total = 0, temp=0; int subtotal=0; char A, B, C, D; do { cout <<"\n\t Enter the time: "; gets(time); cout <<"\n\t Enter the name: "; gets(name); cout << "\n\t This are the menu: \n"; cout << "\n\t A.Beverage RM 2 \n"; cout << "\n\t B.Baked goods RM 3 \n"; cout << "\n\t C.Sandwich RM 4 \n"; cout << "\n\t D.Soup RM 5 \n"; cout << "\n\t What do you want? "; cin >> pilihan; switch ( pilihan ) { case 'A' : price = 2; break; case 'B' : price = 3; break;
case 'C' : price = 4; break; case 'D' : price = 5; break; } cout << "\n\t How much do want to order?"; cin >> num; subtotal = num * price; total = subtotal + temp; temp = subtotal; cout << "\n\t Your subtotal is :" << subtotal; cout << "\n\t Your total is :" << total<<endl; cout << "\n\t Do you want to add order?'Y' or 'N' "; cin >> teruskan; } while ( teruskan == 'Y'); //cost[1]='0'+total; order.enque(time, orderno, name, cost); numrecord = numrecord + 1; cout<<"\n\n\t Number of Records is: "<<numrecord<<endl; cout<<"\n\n\t Enter another order? 'Y' or 'N' "; } while (toupper(getch())=='Y'); break; case '2': { if (!order.empty()) { order.serve (time, orderno, name, cost, &numrecord);//remove item order.display (time, orderno, name, cost); //from queue cout <<"\n\t This order has been deleted from queue "; cout <<"\n\n\t Press any key to continue..."; getch(); } else { cout <<"\n\t NO ORDERS TO DELETE ";
18 Tim Hortons Restaurant } } break; case '3': { clrscr(); if(order.empty()) { cout<<"\n\t NO ORDERS TO DISPLAY "; } else { order.show (time, orderno, name, cost, &numrecord);//display data from data file } } break; case '4': clrscr(); cout<<"\n\n\t The Number of records is "; cout<<numrecord; break; case '5': choice ='Q'; break; } cout<<"\n\n\t Enter M to return to Menu or Q to Quit "; } while (toupper(getch())=='M'); clrscr(); fstream outfile; outfile.open("FastFood.dat",ios::out); while(!order.empty()) { order.serve (time, orderno, name, cost ,&numrecord); outfile << "\n\t" << time <<"\t\t" << orderno << "\t\t " << name << "\t\t " << cost; cout << numrecord; index++; } outfile.close(); };