Restaurant Management System Third Year
Restaurant Management System Third Year
Restaurant Management System Third Year
University of Manchester
Author: Supervisor:
Carl Abernethy Prof. Chris Taylor
Abstract
This report documents the process of designing, developing and testing a software system to be used in a
restaurant; usually given the name restaurant management system. The restaurant management system
is there to help communication between all teams within a restaurant by minimising the probability
of human errors. This report was written by Carl Abernethy as part of his 3rd year project and was
published on May 5, 2010.
Acknowledgements
I would like to thank my project supervisor, Prof. Chris Taylor, for providing an awful amount of
guidance and input throughout the writing of this report. In addition, I’d like to thank my family for
the support throughout my final year at university, and for checking over my report.
Contents
1 Introduction 6
1.1 Chapter Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2 The Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.3 Project Objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.4 Existing Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.5 Project Proposal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.6 Summary of Chapters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.7 Commonly Used Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.8 Closing Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2 Background 10
2.1 Chapter Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.2 Point-of-Sale (POS) Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3 Existing Point-of-Sale (POS) Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.4 Platform Choice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.5 Software Choice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.6 UML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.7 Requirement Gathering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.8 Development Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.9 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3 Requirement Analysis 14
3.1 Chapter Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.2 Stakeholder Identification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.3 Use Cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.4 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.5 Measureable Goals and Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.5.1 Functional Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.5.2 Non-Functional Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.6 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4 Design 20
4.1 Chapter Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.3 Component Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.4 Data Storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.4.1 Relational Database Management System (RDBMS) . . . . . . . . . . . . . . . . 20
4.4.2 Extensible Markup Language (XML) . . . . . . . . . . . . . . . . . . . . . . . . . 21
3
4.4.3 Storage Method Chosen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.4.4 Normalisation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
4.4.5 Entity Relationship Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.4.6 Database Design Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.5 Graphical User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.5.1 Order GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.5.2 Kitchen GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.5.3 Management GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.6 Pricing Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.7 Flow Charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.8 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
5 Implementation 32
5.1 Chapter Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
5.2 Implementing Extreme Programming (XP) . . . . . . . . . . . . . . . . . . . . . . . . . 32
5.3 Data Storage and Retrieval . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
5.4 Stock Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
5.5 GUI Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
5.5.1 Order GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
5.5.2 Kitchen GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
5.5.3 Management GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
5.6 Pricing Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
5.7 Code Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
5.8 Version Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
5.9 Error Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
5.10 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
6 Results 42
6.1 Chapter Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
6.2 Management Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
6.2.1 Data Entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
6.2.2 Stock Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
6.2.3 Offer Entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
6.2.4 System Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
6.2.5 Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
6.3 Order Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
6.4 Kitchen Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
6.5 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
7 Testing 61
7.1 Chapter Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
7.2 Testing Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
7.2.1 Unit Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
7.2.2 User Acceptance Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
7.2.3 Usability Testing and Usability Inspection . . . . . . . . . . . . . . . . . . . . . . 63
7.3 Testing Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
7.4 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
8 Conclusion 65
8.1 Chapter Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
8.2 Project Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
8.3 Further Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
8.3.1 Graphical User Interface (GUI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
8.3.2 Table Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
8.3.3 Cooking Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
8.3.4 Online Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
8.4 Reflection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
8.5 Skills Attained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
8.6 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Bibliography 66
List of Figures 69
List of Tables 71
List of Listings 72
C Database Structure 78
E Pricing Algorithm 81
Chapter 1
Introduction
6
RESTAURANT MANAGEMENT SYSTEM CHAPTER 1. Introduction
of the least efficient approaches. Even though this approach is implemented in successful profitable
restaurants, there are several problems which could be seen as reducing the restaurant’s efficiency:
• Miscommunication caused by handwriting.
2 An order that has been taken but not yet paid for.
7 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 1. Introduction
Table 1.1: A table showing the proposed features of the system and the motivation behind the features.
Feature Motivation
Automated stock control. Real-time view of ingredient stock levels so
only the meals with enough ingredient stock
can be sold.
Meal option and preference selection. Flexible meal options available for the cus-
tomer.
Wireless order system. Waiters no longer required to walk to and from
the central order computer system.
Advanced discount function. Calculating the best price for the customer.
Order alerts. Kitchen and bar staff in direct communication
with waiters allowing the kitchen to notify the
waiter that service is required.
Flexible GUI design. Software capable of being used on any sized
screen and so must have a flexible design.
Order logging. All orders logged for future query generation.
Large kitchen order display. Easy tracking and viewing of all active2 orders.
8 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 1. Introduction
Table 1.2: A table showing the commonly used words throughout this report.
Word Definition
Ingredient Ingredient of a meal.
Prepared ingredient Collection of ingredients.
Item A meal or drink.
Menu section A section of menu for example starters, meats,
puddings etc.
Suborder A collection of customer ordered items.
Order A set of suborders.
9 Carl Abernethy
Chapter 2
Background
10
RESTAURANT MANAGEMENT SYSTEM CHAPTER 2. Background
The proposed features in table 1.1 were generated from research into numerous POS systems. Table
2.1 shows the comparison between some of the proposed features and the features of other POS systems.
All these POS systems were found on the first page of a Google search on the 14th October 2009.
2.6 UML
Diagrammatic techniques are used to visualise, construct and document software systems under de-
velopment. The most general modelling language to describe both the structure and behaviour of a
software system is Unified Modelling language (UML) created by the Object management group. The
diagrams one can create using UML can be shown by a class diagram (Figure 2.1). Throughout this
report, numerous models defined within the UML class diagram (Figure 2.1) will be used to graphically
represent the system.
11 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 2. Background
12 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 2. Background
when the project has a strict deadline to work to. Roughly a £1 cost of change in the requirement
gathering can cost up to £100 in the testing stage and £1000 in the deployment stage to fix.
13 Carl Abernethy
Chapter 3
Requirement Analysis
Therefore using these 4 questions as a guide, we can generate a list (Table 3.1) of the stakeholders
in this project.
14
RESTAURANT MANAGEMENT SYSTEM CHAPTER 3. Requirement Analysis
Figure 3.1 shows several use case scenarios of the system that convey how the stakeholders interact
with the features to achieve a business requirement. The use case scenarios from figure 3.1 can be
found in Appendix B.
The use case diagram is designed to be sequential so by following the use cases down the spine, one
can follow the major steps of an order and several post features to query the data.
3.4 Features
An important part of requirements gathering is the production of a list of system features that cat-
egorises on priority.
Table 3.2: A table showing the proposed system features and allocated priorities.
Feature Priority
Communication of data between each application. 1
Minimum click touch screen GUI design for efficient ordering. 1
Meal ingredient and cooking preference options. 1
Interface to view active orders in the kitchen. 1
Ability to add flexible discounts; calculating best price for the customer. 1
Interface to maintain and manage the menus and associated meals. 1
Stock control for all ingredients; reducing/increasing stock automatically. 1
Ability to define groups of ingredients that may be used in numerous meals. 2
Flexible meal grid design to fit any screen size. 2
Real time waiter status alerts. 2
User login functionality. 3
Interface for table management and selection. 3
Figure generation; management can view statistics in numerous forms. 3
Automatic daily stock level alerts. 3
Ability to define meals by images as well as text. 3
15 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 3. Requirement Analysis
Book Table
Check/Deduct Stock
Waiter Chef
<<include>>
<<include>> <<include>>
Collect Order
Staff Bar Staff Call Server
Customer
Serve
Food/Drink
Eat Food
<<include>>
Generate Reports
Manage menu
& ingredients
Order Stock
<<include>>
<<include>>
Stock Check
Login
Figure 3.1: Use case diagram showing some of the major features within the restaurant management
system.
16 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 3. Requirement Analysis
(SRS) is a complete list of requirements to be designed and developed and can take the form of functional
or non-functional requirements.
17 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 3. Requirement Analysis
4A menu is active when the current time is within the specified time interval of the menu.
18 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 3. Requirement Analysis
19 Carl Abernethy
Chapter 4
Design
4.2 Introduction
This project has been designed using numerous diagrammatic techniques. Recall from Section 2.6, that
the most general modelling language to describe both the structure and behaviour of a software system
is Unified Modelling language (UML).
Use case diagrams have already been used in the requirements analysis as a way to graphically
overview the order process within the system. Other diagrams from the UML family are used in the
design stage to show the structure and behaviour of numerous sophisticated design features.
20
RESTAURANT MANAGEMENT SYSTEM CHAPTER 4. Design
MySQL
<< database >>
JDBC
{}
<< requires >> {}
<< requires >>
Figure 4.1: Component diagram showing the higher level architecture of the system.
RDBMS are one of the most popular data storage methods out in the market and offer many advantages
including:
• Fast data extraction using structured query language (SQL).
In industry, there are numerous expensive highly functional RDMBSs including Oracle and SQLServer
that are very popular and offer technical support. However, there are also numerous open-source solu-
tions with many adjudged to be as good or better and are becoming even more popular with small
scale software systems.
21 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 4. Design
querying language and for the queries required and the type of software system begin designed, it was
concluded that RDBMS would be the best storage method.
The next choice was to decide on the type of RDBMS to use. As discussed there are many open
source RDBMSs available for us to choose from and for the main reason of experience, MySQL was the
preferred option. Figure 4.2 shows just how competitive the performances of different RDBMSs are.
4.4.4 Normalisation
Normalisation comes in many forms ranging from first normal form to sixth normal form. The nor-
malisation of a database is a systematic way to free the database of undesirable characteristics where
inserts, updates and deletions of data could lead to the loss of data integrity. The greater the normal
form, the greater the data integrity of the database.
The database in this system was designed to be in Boyce-Codd normal form which is a slightly
stronger version of the third normal form. For the database to be in Boyce-Codd normal form, it had
to pass for all previous normal forms as well as Boyce-Codd normal form.
A well designed database will normally abide by the first, second and third normal forms as they
are the basics to a well structured relational database. According to Horsforth School [17], the first
three normal forms can be defined as:
1. First norm: Every attribute is atomic or single valued therefore there are no repeating fields.
2. Second norm: All attributes not part of the primary key must be dependent on the full key.
3. Third norm: There must be no transitive determinants, or each attribute that is not part of
the key must be determined only by the key.
Finally for the database to be in the desired Boyce-Codd normal form, all tables must abide by the
first, second and third normal forms and must not have any determinants that are not candidate keys
for the table.
22 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 4. Design
• Ability to control the stock levels by allocating a variable to all prepared ingredients and meals
with the variable reacting in real time to the status of the items ingredient stock level.
• Ability to cope with new supplies where the price differs to the current price within the database.
23 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 4. Design
Receipt Name
Display Name Available Stock
Key
Price Description
Relationship
Relationship
Meal
attribute
Attribute
Price ID Name
Measurement
ID Name
ID ID Name
Name
Description
0..n 1
BelongsTo
Strength (Drink only)
24 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 4. Design
Table # Complete
Relationship
User # Price
Start Time
Entity Call Server
Defined
ID Ingredient Price
entity Order
Relationship
attribute
1
Attribute
Contains
Cooked
Suborder Time ID
1..n ID Price
User #
0..n 1..m
Complete Suborder Contains Suborder Product
Active
Removed
Contains Contains
Food/Drink
Food/Drink
Name Optional
1 1
ID Name Colour
ID Active
1..n
From
ActiveOn
0..n 0..n
To 0..n
0..n
0..m Replaced Replaced
Original
Original
ID
Days
0..1 0..1
0..1
0..1
Name
1..n
0..m
From Contains Set #
ActiveOn
To 0..m Ingredient
Prepared Ingredient
1..n
ID ID Name
Menu Height/Width
N Set 2
Figure 4.4: Entity Relationship of the menu, order, offer and system settings.
25 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 4. Design
Select Menu => Select Item(s) => Show Item(s) Select Menu => Select Item(s)
Food
Select Food/drink Drink
Food
=> Select Menu
Drink
Menus
Select Food/drink
=> Select Menu
Menus
Transaction
Grid of items
List
Grid of items
Tables
Tables
Price
Command buttons
Command buttons
Figures 4.5 shows a design of the order GUI that abides by the specification. The design keeps the
sequence of steps in a chronological order to minimise hand movement from step to step. By following
the design top to bottom and left to right, the order starts from the top left corner and eventually
finishes at the bottom right corner. This not only helps keep the GUI structured, but allows the user
to use their initiative if unfamiliar hence decreasing the learning curve.
26 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 4. Design
The order process is controlled by the command buttons at the bottom. These allow the user to
create an order, add a suborder to an existing order and complete an order. The three purple grids
down the left hand side contains the different menus and current active suborders. The blue grid in the
centre contains the different sections of the selected menu and the associated meals and drinks within
the sections. The ‘Transaction List’ and ‘Price’ boxes show the current items within the suborder and
the current price respectively.
The shape of the design in Figure 4.5 accommodates all normal size monitors with the grid size
for the food/drink, menus, tables and items all customisable. Hence with little or no change the basic
components in the order GUI can be designed to fit a PDA screen with a resolution of around 480
by 320 as shown in Figure 4.6. In the designs, Figure 4.5 would use, as default, the grid sizes 8x8
(items), 2x1 (food/drink), 2x3 (menus) and 3x8 (tables) where as the PDA GUI Figure 4.6 would use,
as default, the grid sizes 4x4 (items), 1x2 (food/drink), 1x3 (menus) and 1x8 (tables). Note, these
dimension would be the preset default values and would be changeable in the system settings.
1 2 3 1 2 3
3 2 3
Starters
Main Course
1 2 3 1 2 3
1 2 3 1 2 3
Figure 4.7: GUI grid expansion. Figure 4.8: GUI grid items algorithm.
As we can never assume the number of items, menus and tables active at any one point, all the
grids should be able to automatically resize when the grid becomes full adding an extra row to the
bottom. Figure 4.7 visually shows how a full grid resizes when an additional item is added.
As well as the general layout, individual components required specific design details incorporated.
As new meals and drinks could be added to the menu at any point, then if a normal grid was used,
the addition of a new item that wasn’t at the end of the grid would shift all items after the newly
inserted item by one. At sight this is a problem, as with frequent use of the system, the user becomes
accustomed to the exact position of certain functions. Hence a change to the layout could lead to an
increase in human errors and a decrease in the user transaction speed.
Figure 4.8 shows a solution that assigns the starting item in every menu section a new line therefore
the shifting of items would only occur when a section requires an extra line.
Finally, a well known saying is that a ‘picture tells a thousand words’, therefore by allowing the
system to use transparent images as well as the text, the end user should locate the particular item
faster.
27 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 4. Design
Menu
Ordered Food Items
Section
Menu List Of
Ordered Food Items
Section Suborders
Menu
Ordered Food Items
Section
Command
Ordered Food Items
buttons
Tabs
Tabs: Different forms for inputting data
Search
tool
Details of
the selected
item
Items
Different
functions
available
Command buttons
28 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 4. Design
29 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 4. Design
From this example we notice that the greedy method finds a solution but is not the optimal solution.
Therefore we can rule out this classification of algorithm.
Another approach could be to try and redraw the problem into a graph with one source and one
sink, then use an optimisation algorithm such as the max-flow min-cut theorem. In order to apply an
optimisation theorem we need to develop a graph that either has an edge or vertex weight. In our case,
the edge weight would be the saving made when that specific offer is applied to the set. Once again,
there is a drawback to this type of algorithm. As an offer is applied the set decreases so to draw the
problem as a graph would just be drawing the exhaustive algorithm out, hence this attempt would lead
back to the same complexity.
After numerous attempts at other approaches, the only algorithm that guarantees the optimal
solution is the exhaustive approach. Therefore we can calculate the best and worst case scenario. The
best case scenario is when there are n items in the order, and m amount of offers but zero offers apply to
the order. The worst case scenario is when there are n items and m offers and with each offer removing
one item from the order each time. Hence in the worst case the time complexity will be O(nm ) which
is perfectly workable for likely values of n and m.
30 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 4. Design
Start
Table
Table or no table?
No table
No
Add
another
item
Automatically deduct
stock amount.
Confirm order.
Yes
Order contain
Prepare drinks
drink items?
No
Drink: No
&
Drink complete; Food: No
Order contain
infrom server.
food items?
Colour: Colour 2
Drink: Yes
& Food: Yes
Food: No
Cook food.
Food complete;
inform server.
Colour: Colour 3
Server collects
complete food/drink
Yes
31 Carl Abernethy
Chapter 5
Implementation
32
RESTAURANT MANAGEMENT SYSTEM CHAPTER 5. Implementation
retrieve data to the database could extend this generic class giving that object the functionality to
insert, delete and update any table within the database.
2. An optional ingredient change, therefore a decrease of stock for the ingredient selected and an
increase in the original ingredient stock.
5. An item removed from the order, therefore an increase in the stock of all the ingredients within
that item.
When the stock levels changed in any of these circumstances, a database function updated the available
stock field to a value between 0 and 4 inclusive. Every ingredient and prepared ingredient link table
would hold a similar stock status between 0 and 2 inclusive as the ingredient is only defined compulsory
or optional within the link between the ingredient and item.
The database functions that updated the available stock fields were:
• Reduce ingredient stock: When an item is selected, this function deducted the specified
amount from the ingredient stock level.
• Increase ingredient stock: When an optional ingredient was removed or swapped, this func-
tion increased the specified amount from the ingredient stock level.
• Reduce prepared ingredient stock: When an item was selected, this function deducted the
specified amount for all the ingredients within the prepared ingredient. This function also accom-
modated the requirement were a prepared ingredient could be an ingredient of another prepared
ingredient.
33 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 5. Implementation
• Increase prepared ingredient stock: When an optional prepared ingredient was removed
or swapped, this function would increase the specified amount for all the ingredients within
the prepared ingredient. This function also accommodated the requirement were a prepared
ingredient could be an ingredient of another prepared ingredient.
• Update available stock: When an ingredients stock level changed, this function updated the
available stock field within the meal and prepared ingredient table.
• Update available stock (meal only): When a meal added or removed a prepared ingredient
to its ingredients list, this function updated the available stock field within the meal table.
Listing 5.1 gives an example of a function within the MySQL database for increasing ingredient
stock. Two more coded examples can be found in Appendix D.
/∗ D e f a u l t measurement s p e c i f i e d i n t h e i n g r e d i e n t t a b l e ∗/
i f ( subOrderProductID = 0 ) t h e n
SELECT DISTINCT i n g r d . Default_Measurement , Ingrd_Stock_ID i n t o amount , s t o c k I D
FROM i n g r d
WHERE i n g r e d i e n t _ i d = i n g r e d i e n t I D ;
/∗ Manuaul measurement s p e c i f i e d i n t h e meal i n g r e d i e n t t a b l e ∗/
else
/∗ Get t h e manual measurement and i n g r e d i e n t s t o c k ID ∗/
SELECT DISTINCT meal_ingrd . Manual_Measurement , i n g r d . Ingrd_Stock_ID i n t o amount , s t o c k I D
FROM ( s u b _ o r d e r _ p r o d u c t s
INNER JOIN meal_ingrd ON s u b _ o r d e r _ p r o d u c t s . Product_ID = meal_ingrd . Product_ID )
INNER JOIN i n g r d ON meal_ingrd . I n g r e d i e n t _ I D = i n g r d . I n g r e d i e n t _ I D
WHERE ( ( ( s u b _ o r d e r _ p r o d u c t s . Sub_Order_Product_ID)= subOrde rProductID )
AND ( ( meal_ingrd . I n g r e d i e n t _ I D )= i n g r e d i e n t I D ) ) ;
end i f ;
/∗ S u b t r a c t t h e amount from t h e i n g r e d i e n t s t o c k t a b l e ∗/
UPDATE i n g r d _ s t o c k
SET current_amount = current_amount + amount
WHERE ingrd_Stock_ID = s t o c k I D ;
END
34 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 5. Implementation
Synchronized GUI
A feature specified within the order GUI design specification was to keep the GUI in real-time and
therefore only show the active menus and only apply the active offers. Hence, the database schema was
designed to allow both the menus and algorithms to be time based so that they were only valid at the
specified time periods.
This specific specification was implemented by using SQL queries to only extract out the menus
currently active and Java threads to keep the GUI synchronised. Listing 5.2 gives an example of an
SQL query used within the thread to extract out the active menus. This query compares the menu
time against both the order start time and the current time. The reason behind this was that if a
customer entered the restaurant when a menu was active but then ordered from the menu when the
menu was inactive, the system wouldn’t allow this by just comparing the current and menu time.
The thread constantly called an update function every x amount of seconds with x being the refresh
rate specified by the user. Within the same thread, the table grid, menu section and meal item stock
colour were updated using similar SQL queries with the latter explained later in this section.
35 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 5. Implementation
Figure 5.1: A screenshot of the implemented optional and preference GUI component.
4. Preference grid showing the preference options of an ingredient within the meal.
36 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 5. Implementation
Figure 5.2: Screenshot showing a replaced optional Figure 5.3: Screenshot showing an optional ingredi-
ingredient. ent removed.
37 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 5. Implementation
Grid Implementation
Many of the components within the order GUI implemented a grid algorithm. This grid algorithm used
a basic layout, where each component appeared one after the other, but with the added functionality
of auto expanding rows. Listing 5.3 shows the generic psuedocode that implemented this simple grid
expansion.
However the main grid implemented a different algorithm as explained in the design Section 4.5.1.
Recall, that this grid would show the meals and drinks, but would be separated into blocks of sections
with each section starting on a new row. The added problem was that the grid would not be a basic
grid but column based. An example would be, an 8 x 8 grid could represent as a 16 x 4 grid. Listing
5.4 shows the pseudocode of the algorithm used to create and fill this type of grid.
Stock control
The stock control was implemented using triggers within the database as discussed in Section 5.4. This
sub-section explains how the system would visually display the meals.
Recall that an integer in the range of zero to five was applied to all meals with the integer referring
to the ingredient stock statuses defined in table 6.1 in Section 5.4. The Java thread that kept the GUI
38 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 5. Implementation
synchronised with the available menus and tables also implemented a function to highlight the specific
meals that appeared under any status where an ingredient was low or out of stock.
Each button that represented a meal or drink would have a specific coloured border. The border
would be updated depending on the index of that meal within the database. Table 5.4 defines the five
different statuses available and the colours allocated for that status.
Table 5.4: A table showing the available ingredient stock status and the allocated colour.
Value Defining Colour
0 Compulsory ingredient out of stock. Red
1 Compulsory ingredient low on stock. Orange
2 Optional ingredient out of stock. Yellow
3 Optional ingredient low on stock. Blue
4 No stock issues. Black
39 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 5. Implementation
As discussed in the design, the exhaustive algorithm approach was chosen to find the best price.
The algorithm can be drawn into a tree structure where the root is the initial set of items from the
order and each child node is a subset of its parent’s node after the application of an offer.
As with most tree structure algorithmic solutions, the code solution used recursion.
/∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ /
R e c u r s i v e method ( o f f e r A r r a y , 2 dOrderArray )
/∗ 2 dOrderArray h o l d s d a t a b a s e i t e m ID and p r i c e
P r i c e c a l c u l a t e d a l o n g t h e way ∗/
f o r ( i = 0 ; i < o f f e r A r r a y s i z e ; i ++)
b o o l e a n s u c c e s s = a p p l y O f f e r t o 2 dOrderArray /∗ Changes p r i c e s w i t h i n 2 dOrderArray ∗/
i f ( success = true )
c a l l r e c u r s i v e method ( o f f e r A r r a y , new2dOrderSet )
else
c h e a p e s t P r i c e ( 2 dOrderArray )
end i f
end f o r
The pseudocode in Listing 5.5 gives a basic idea as to how the algorithm was created, but in fact
the coded version was much more complicated.
To increase the efficiency of this exhaustive algorithm, SQL was used in the generation of the offer
objects, so that the sets within the offer objects only contained items currently within the order, hence
a reduction in the amount of comparisons.
The fully coded version of the algorithm can be found in Appendix E.
40 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 5. Implementation
For this project, each iteration within the development methodology utilised the version control
system by archiving and saving each prototype.
41 Carl Abernethy
Chapter 6
Results
• Offer entry.
• System Settings.
• Statistics.
42
RESTAURANT MANAGEMENT SYSTEM CHAPTER 6. Results
43 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 6. Results
44 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 6. Results
45 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 6. Results
Figure 6.8: A screenshot of the first input value Figure 6.9: A screenshot of the second input value
required when adding stock. required when adding stock.
46 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 6. Results
Figure 6.10: A screenshot of the form used to input the type 1 offer.
In Figure 6.10, the example within the screenshot demonstrates an offer of buy 1 item from set
‘Evening Offer Set 1’, 1 item from set ‘Evening Offer Set 2’ and 1 item from set ‘Evening Offer Set 3’
for £11.99. The offer is available every day.
In Figure 6.11, the example within the screenshot demonstrates an offer of buy 1 item from set ‘Alg
B3’ and get 1 item from set ‘Alg Pud’ for free. The offer is only available on Wednesday.
Figure 6.12 and 6.13 shows screenshots of the input forms used to add offer sets and availability to
either offer one or offer two.
47 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 6. Results
Figure 6.11: A screenshot of the form used to input the type 2 offer.
Figure 6.12: A screenshot of the form used to add the sets within an offer.
Figure 6.13: A screenshot of the form used to add the availability of an offer.
48 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 6. Results
Table 6.1: A table defining the menu properties within the system settings form.
Property Result
Menu: Height The height of a sub grid within the main grid.
Menu: Width The width of a sub grid within the main grid.
Menu: Text Size Text size of the text within the main grid.
Menu: Column Groups The amount of sub grids from left to right within the main grid.
Menu: Character Limit (per line) The maximum amount of characters per line for the item buttons.
Menu: Transparency ([0,1]) How transparent the image behind the text is for the item buttons.
The form also contains similar properties for the menu section and colour selectors for the waiter
calls. Figure 6.14 gives an example of settings for a desktop with the resulted layout in figure 6.16.
Figure 6.15 gives an example of settings for a PDA with the resulted layout in figure 6.17.
49 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 6. Results
Figure 6.16: A screenshot showing the result of using the system settings in figure 6.14.
50 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 6. Results
Figure 6.17: A screenshot showing the result of using the system settings in figure 6.15.
51 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 6. Results
6.2.5 Statistics
The final section within the management application was to show daily, monthly and year statistics.
Unfortunately as this was a priority 3 requirement, only a couple of graphs were implemented.
Figure 6.18: A screenshot showing a pie chart of the daily meal count within the restaurant.
Figure 6.19: A screenshot showing a bar chart of the weekly takings within the restaurant.
52 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 6. Results
Figure 6.21: A screenshot showing the different components within the GUI.
53 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 6. Results
Figure 6.22: A screenshot showing the options sub-form when selecting ‘Sirloin Steak’.
Figure 6.23: A screenshot showing the available options and cooking preferences.
54 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 6. Results
Figure 6.25: A screenshot showing how the GUI displays meals with low or no stock.
Figure 6.26: A screenshot showing the status of a suborder once confirmed by the chef.
55 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 6. Results
56 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 6. Results
Figure 6.30: A screenshot showing suborder complete; removed from suborder grid.
57 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 6. Results
58 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 6. Results
59 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 6. Results
60 Carl Abernethy
Chapter 7
Testing
p u b l i c c l a s s U n i t T e s t e x t e n d s Te s tCas e {
i n t databaseID = 9 0 ; // S p e c i f i e d d a t a b a s e ID
p u b l i c U n i t T e s t ( S t r i n g testName ) { s u p e r ( testName ) ; }
@Override
p r o t e c t e d v o i d setUp ( ) t h r o w s E x c e p t i o n { s u p e r . setUp ( ) ; }
@Override
61
RESTAURANT MANAGEMENT SYSTEM CHAPTER 7. Testing
p r o t e c t e d v o i d tearDown ( ) t h r o w s E x c e p t i o n { s u p e r . tearDown ( ) ; }
/∗ ∗ T e s t o f i n s e r t method , o f c l a s s Unit . ∗/
p u b l i c void t e s t I n s e r t ( ) throws Exception {
System . ou t . p r i n t l n ( " i n s e r t " ) ;
S t r i n g u n i t = "UNIT_TEST_CASE" ;
Unit i n s t a n c e = new Unit ( ) ; // C r e a t e s u n i t o b j e c t
i n t expResult = databaseID ; // Expected r e s u l t s p e c i f i e d above
int r e s u l t = instance . i n s e r t ( unit ) ; // I n s e r t method
a s s e r t E q u a l s ( expResult , r e s u l t ) ; // Compare e x p e c t e d ID t o r e t u r n e d ID
}
/∗ ∗ T e s t o f e d i t R e c o r d method , o f c l a s s Unit . ∗/
p u b l i c void t e s t E d i t R e c o r d ( ) throws Exception {
System . ou t . p r i n t l n ( " e d i t R e c o r d " ) ;
S t r i n g name = "UNIT_TEST_CASE" ; // Old name
S t r i n g newName = "UNIT_TEST_CASE_NEW_NAME" ; // New name
Unit i n s t a n c e = new Unit ( ) ; // C r e a t e s u n i t o b j e c t
i n s t a n c e . e d i t R e c o r d ( name , newName ) ; // E d i t method
i n s t a n c e . g e t U n i t ( "UNIT_TEST_CASE_NEW_NAME" ) ; // Gets t h e new u n i t o b j e c t
S t r i n g expName = i n s t a n c e . getUnitName ( ) ;
a s s e r t E q u a l s ( expName , newName ) ;
}
/∗ ∗ T e s t o f getUnitName method , o f c l a s s Unit . ∗/
p u b l i c v o i d testGetUnitName ( ) t h r o w s E x c e p t i o n {
System . ou t . p r i n t l n ( " getUnitName " ) ;
Unit i n s t a n c e = new Unit ( ) ; // C r e a t e s u n i t o b j e c t
S t r i n g e x p R e s u l t = "UNIT_TEST_CASE_NEW_NAME" ;
instance . getUnit ( expResult ) ; // Gets t h e new u n i t o b j e c t
S t r i n g r e s u l t = i n s t a n c e . getUnitName ( ) ; // R e t u r n s u n i t name
a s s e r t E q u a l s ( expResult , r e s u l t ) ;
}
/∗ ∗ T e s t o f d e l e t e R e c o r d method , o f c l a s s Unit . ∗/
p u b l i c void t e s t D e l e t e R e c o r d _ S t r i n g ( ) throws Exception {
System . ou t . p r i n t l n ( " d e l e t e R e c o r d " ) ;
S t r i n g name = "UNIT_TEST_CASE_NEW_NAME" ;
Unit i n s t a n c e = new Unit ( ) ; // C r e a t e s u n i t o b j e c t
boolean expResult = true ; // Expected r e s u l t
b o o l e a n r e s u l t = i n s t a n c e . d e l e t e R e c o r d ( name ) ; // Returned r e s u l t
a s s e r t E q u a l s ( expResult , r e s u l t ) ;
}
}
62 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 7. Testing
In this project, at numerous iterations, the customer sometimes defined as the subject matter expert
(SME) trialled and reviewed the current prototype of the system. The customer then gave feedback and
confirmed whether the system met the agreed-upon requirements. This type of testing only appeared
in the last few iterations, as the GUI was one of the latter features to be developed and without a GUI,
user acceptance testing would gain no benefit.
3. Meal has o amount of optional ingredients with all optional ingredients being removed or swapped
(2o clicks).
4. Meal also has p amount of ingredients each requiring a preference choice (2p clicks).
5. Repeat steps 2,3 and 4 for m amount of meals (m(1 + 2o + 2p) clicks).
Therefore in the worst case scenario, the time complexity would be O(s(3 + m(1 + 2o + 2p)) + 2).
The best case scenario:
63 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER 7. Testing
Therefore in the best case scenario, the time complexity would be O(1 + m + 1 + 2).
Hence the time complexity is of polynomial complexity in the worst case scenario and linear com-
plexity in the best case scenario.
64 Carl Abernethy
Chapter 8
Conclusion
65
RESTAURANT MANAGEMENT SYSTEM CHAPTER 8. Conclusion
8.4 Reflection
On reflection, even though the majority of the proposed features were completed and the project was
deemed a huge success, the author felt that he could have been more disciplined in keeping to the plan.
He also felt that the proposed features were slightly unrealistic and some even unnecessary.
For the general project, the author felt that important aspects of research were not undertaken
including interviews with restaurant owners and user questionnaires. This would have provided good
insight into existing solutions.
66 Carl Abernethy
Bibliography
[1] Ian Alexander. Computing & control engineering. Volume 14(Issue 1):22–26, April 2003.
[5] Geoffrey Elliot. Global business information technology: an integrated systems approach. Pearson
Education, 2004.
[8] Java JDBC. Java SE Technologies - Database. Accessed on 3 May, 2010. http://java.sun.com/
javase/technologies/database/.
[9] Paul Lemberg. Which is Better: New customers or repeat business?. Accessed on 12 October,
2009. http://www.businessknowhow.com/marketing/new-customers.htm.
[10] Agile Manifesto. Principles behind Agile Manifesto. Accessed on 20 September, 2009. http:
//www.agilemanifesto.org/principles.html.
[11] Craig Murphy. Improving Application Quality Using Test-Driven Development (TDD). Accessed
on 16 October, 2009. http://www.methodsandtools.com/archive/archive.php?id=20.
[12] A Nutt. History of pos equipment. Computers and Internet community, 1:1, March 2009.
[13] Point of Success. Products and Features. Accessed on 14 October, 2009. http://www.
pointofsuccess.com/softwarefeatures.htm.
[15] Steve Rosenberg. Fast food, German-style. Accessed on 15 October, 2009. http://news.bbc.co.
uk/1/hi/7335351.stm.
67
RESTAURANT MANAGEMENT SYSTEM BIBLIOGRAPHY
[16] s Baggers restaurant. Rollercoaster style restaurant. Accessed on 13 October, 2009. http://www.
sbaggers.de/main-ger/?sid=home&lang=en.
[17] Horsforth School. Normalisation. Accessed on 1 December, 2009. http://www.horsforth.leeds.
sch.uk/subjects/comp/alevel/module5/unit59/unit59d.asp.
[18] Restaurant Pos Software. HOSPOS. Accessed on 14 October, 2009. http://www.
restaurant-pos-software.com/Products/HospitalitySoftware.aspx.
[19] Don Wells. Unit Tests. Accessed on 24 September, 2009. http://www.extremeprogramming.org/
rules/unittests.html.
68 Carl Abernethy
List of Figures
3.1 Use case diagram showing some of the major features within the restaurant management
system. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.1 Component diagram showing the higher level architecture of the system. . . . . . . . . . 21
4.2 Database comparison diagram [3]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
4.3 Entity Relationship diagram of a meal. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4.4 Entity Relationship of the menu, order, offer and system settings. . . . . . . . . . . . . . 25
4.5 Design of the order GUI for a monitor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.6 Design of the order GUI for a PDA. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.7 GUI grid expansion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.8 GUI grid items algorithm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.9 Design of the kitchen GUI. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.10 Design of the management GUI. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.11 Visual example of the price algorithm problem. . . . . . . . . . . . . . . . . . . . . . . . 29
4.12 Flow chart to show the flow of events of an order. . . . . . . . . . . . . . . . . . . . . . . 31
69
RESTAURANT MANAGEMENT SYSTEM LIST OF FIGURES
70 Carl Abernethy
List of Tables
1.1 A table showing the proposed features of the system and the motivation behind the
features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.2 A table showing the commonly used words throughout this report. . . . . . . . . . . . . 9
6.1 A table defining the menu properties within the system settings form. . . . . . . . . . . 49
71
List of Listings
72
Appendix A
For my third year project I have to design a restaurant management system. This will involve designing
a system for the restaurant, kitchen, and bar.
1. Increase efficiency of the restaurant by decreasing process time. This will speed up table turning
which will result in an increase in profit.
2. Simplify communication between the restaurant and kitchen staff. All orders taken by the staff
will result in a request on the monitors in the kitchen with all orders being separated by table
and cooking time.
3. Provide planning for the future. Ingredient usage will be taken into account providing approx-
imation into ingredient demand. This will help keep stock levels to the minimum increasing the
average freshness of the produce.
4. Ease of setup for the end user – adding ingredients, costs, menus etc to the system.
5. Ease of figure generating: revenue, turnover, profit, and operating costs.
6. Design a user friendly front end whilst still allowing all combinations of options and extras for
every meal.
7.
1. The system will require a very simple user interface with touch screen capability.
2. Colour co-ordinated menu is a necessity. Advanced options incorporated into the simple front
end to reduce the potential limitations. Allow options for every meal including extras that can
be added at an extra cost.
73
RESTAURANT MANAGEMENT SYSTEM CHAPTER A. Initial Project Plan
3. User credentials to track the transaction history and average table turning time of every member
in the team.
4. SQL Server/Oracle relational database to hold all the ingredients and courses with a hierarchy
so ingredients can be allocated into food types. Creating food types will simplify the front end
with respect to showing extras and options of a meal.
1. Bluetooth PDA’s for the restaurant staff so the orders will be immediately sent to the kitchen
staff decreasing process time.
74 Carl Abernethy
Appendix B
The following tables document the use cases from Figure 3.1.
75
RESTAURANT MANAGEMENT SYSTEM CHAPTER B. Use Case Scenarios
76 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER B. Use Case Scenarios
77 Carl Abernethy
Appendix C
Database Structure
Due to the size of the database (amount of tables), the following diagram only shows the table names
and relationships.
78
Appendix D
i f ( subOrderProductID = 0 ) t h e n
SELECT DISTINCT i n g r d . Default_Measurement , Ingrd_Stock_ID i n t o amount , s t o c k I D
FROM i n g r d
WHERE i n g r e d i e n t _ i d = i n g r e d i e n t I D ;
else
/∗ Get t h e manual measurement and i n g r e d i e n t s t o c k ID ∗/
SELECT DISTINCT meal_ingrd . Manual_Measurement , i n g r d . Ingrd_Stock_ID i n t o amount , s t o c k I D
FROM ( s u b _ o r d e r _ p r o d u c t s
INNER JOIN meal_ingrd ON s u b _ o r d e r _ p r o d u c t s . Product_ID = meal_ingrd . Product_ID )
INNER JOIN i n g r d ON meal_ingrd . I n g r e d i e n t _ I D = i n g r d . I n g r e d i e n t _ I D
WHERE ( ( ( s u b _ o r d e r _ p r o d u c t s . Sub_Order_Product_ID)= subOrde rProductID )
AND ( ( meal_ingrd . I n g r e d i e n t _ I D )= i n g r e d i e n t I D ) ) ;
end i f ;
/∗ S u b t r a c t t h e amount from t h e i n g r e d i e n t s t o c k t a b l e ∗/
UPDATE i n g r d _ s t o c k
SET current_amount = current_amount − amount
WHERE ingrd_Stock_ID = s t o c k I D ;
END
Listing D.2: Database function for updating the stock field within the meal table.
CREATE PROCEDURE ` r e s t m n g s y s ` . ` u p d a t e A v a i l a b l e S t o c k M e a l O n l y ` ( )
BEGIN
/∗ Update a l l m e a l s t o i n i t i a l v a l u e o f 4 : S t o c k l e v e l ok ! ∗/
UPDATE meal s e t a v a i l a b l e _ s t o c k = 4 ;
/∗ Update m e a l s t h a t a r e o p t i o n a l t h a t a r e low t o s t o c k t o 3 ∗/
Update meal s e t a v a i l a b l e _ s t o c k = 3 where p r o d u c t _ i d IN
(
SELECT DISTINCT s e c t i o n _ m e a l s . Product_ID
FROM ( ( ( ( s e c t i o n _ m e a l s
LEFT JOIN meal_ingrd ON s e c t i o n _ m e a l s . Product_ID = meal_ingrd . Product_ID )
LEFT JOIN meal_prep_ingrd ON s e c t i o n _ m e a l s . Product_ID = meal_prep_ingrd . Product_ID )
LEFT JOIN i n g r d ON meal_ingrd . I n g r e d i e n t _ I D = i n g r d . I n g r e d i e n t _ I D )
LEFT JOIN p r e p _ i n g r d _ d e t a i l
ON meal_prep_ingrd . I n g r e d i e n t _ P r e p a r e d _ I D = p r e p _ i n g r d _ d e t a i l . P r e p a r e d _ I n g r e d i e n t _ I D )
LEFT JOIN i n g r d _ s t o c k ON i n g r d . Ingrd_Stock_ID = i n g r d _ s t o c k . Ingrd_Stock_ID
WHERE ( ( ( meal_ingrd . O p t i o n a l )=True )
AND ( ( meal_ingrd . Manual_Measurement)<=i n g r d _ S t o c k . current_amount )
AND ( ( i n g r d _ s t o c k . Current_Amount)<=i n g r d _ S t o c k . min_Threshold ) )
OR ( ( ( meal_prep_ingrd . O p t i o n a l )=True )
79
RESTAURANT MANAGEMENT SYSTEM CHAPTER D. Database Stock Control Functions
AND ( ( p r e p _ i n g r d _ d e t a i l . A v a i l a b l e _ S t o c k ) = 1 ) ) /∗ 1 : S t o c k l e v e l low ∗/
);
/∗ Update m e a l s t h a t a r e o p t i o n a l t h a t a r e o u t o f s t o c k t o 2 ∗/
Update meal s e t a v a i l a b l e _ s t o c k = 2 where p r o d u c t _ i d IN
(
SELECT DISTINCT s e c t i o n _ m e a l s . Product_ID
FROM ( ( ( ( s e c t i o n _ m e a l s
LEFT JOIN meal_ingrd ON s e c t i o n _ m e a l s . Product_ID = meal_ingrd . Product_ID )
LEFT JOIN meal_prep_ingrd ON s e c t i o n _ m e a l s . Product_ID = meal_prep_ingrd . Product_ID )
LEFT JOIN i n g r d ON meal_ingrd . I n g r e d i e n t _ I D = i n g r d . I n g r e d i e n t _ I D )
LEFT JOIN p r e p _ i n g r d _ d e t a i l
ON meal_prep_ingrd . I n g r e d i e n t _ P r e p a r e d _ I D = p r e p _ i n g r d _ d e t a i l . P r e p a r e d _ I n g r e d i e n t _ I D )
LEFT JOIN i n g r d _ s t o c k ON i n g r d . Ingrd_Stock_ID = i n g r d _ s t o c k . Ingrd_Stock_ID
WHERE ( ( ( meal_ingrd . O p t i o n a l )=True )
AND ( ( meal_ingrd . Manual_Measurement)>=i n g r d _ S t o c k . current_amount ) )
OR ( ( ( meal_prep_ingrd . O p t i o n a l )=True )
AND ( ( p r e p _ i n g r d _ d e t a i l . A v a i l a b l e _ S t o c k ) = 0 ) )
);
/∗ Update m e a l s t h a t a r e c o m p u l s o r y t h a t a r e low t o s t o c k t o 1 ∗/
Update meal s e t a v a i l a b l e _ s t o c k = 1 where p r o d u c t _ i d IN
(
SELECT DISTINCT s e c t i o n _ m e a l s . Product_ID
FROM ( ( ( ( s e c t i o n _ m e a l s
LEFT JOIN meal_ingrd ON s e c t i o n _ m e a l s . Product_ID = meal_ingrd . Product_ID )
LEFT JOIN meal_prep_ingrd ON s e c t i o n _ m e a l s . Product_ID = meal_prep_ingrd . Product_ID )
LEFT JOIN i n g r d ON meal_ingrd . I n g r e d i e n t _ I D = i n g r d . I n g r e d i e n t _ I D )
LEFT JOIN p r e p _ i n g r d _ d e t a i l
ON meal_prep_ingrd . I n g r e d i e n t _ P r e p a r e d _ I D = p r e p _ i n g r d _ d e t a i l . P r e p a r e d _ I n g r e d i e n t _ I D )
LEFT JOIN i n g r d _ s t o c k ON i n g r d . Ingrd_Stock_ID = i n g r d _ s t o c k . Ingrd_Stock_ID
WHERE ( ( ( meal_ingrd . O p t i o n a l )= F a l s e )
AND ( ( meal_ingrd . Manual_Measurement)<=i n g r d _ S t o c k . current_amount )
AND ( ( i n g r d _ s t o c k . Current_Amount)< i n g r d _ s t o c k . m i n _ t h r e s h o l d ) )
OR ( ( ( meal_prep_ingrd . O p t i o n a l )= F a l s e )
AND ( ( p r e p _ i n g r d _ d e t a i l . A v a i l a b l e _ S t o c k ) = 1 ) )
);
/∗ Update m e a l s t h a t a r e c o m p u l s o r y t h a t a r e o u t o f s t o c k t o 0 ∗/
Update meal s e t a v a i l a b l e _ s t o c k = 0 where p r o d u c t _ i d IN
(
SELECT DISTINCT s e c t i o n _ m e a l s . Product_ID
FROM ( ( ( ( s e c t i o n _ m e a l s
LEFT JOIN meal_ingrd ON s e c t i o n _ m e a l s . Product_ID = meal_ingrd . Product_ID )
LEFT JOIN meal_prep_ingrd ON s e c t i o n _ m e a l s . Product_ID = meal_prep_ingrd . Product_ID )
LEFT JOIN i n g r d ON meal_ingrd . I n g r e d i e n t _ I D = i n g r d . I n g r e d i e n t _ I D )
LEFT JOIN p r e p _ i n g r d _ d e t a i l
ON meal_prep_ingrd . I n g r e d i e n t _ P r e p a r e d _ I D = p r e p _ i n g r d _ d e t a i l . P r e p a r e d _ I n g r e d i e n t _ I D )
LEFT JOIN i n g r d _ s t o c k ON i n g r d . Ingrd_Stock_ID = i n g r d _ s t o c k . Ingrd_Stock_ID
WHERE ( ( ( meal_ingrd . O p t i o n a l )= F a l s e )
AND ( ( meal_ingrd . Manual_Measurement)>=i n g r d _ s t o c k . current_amount ) )
OR ( ( ( meal_prep_ingrd . O p t i o n a l )= F a l s e )
AND ( ( p r e p _ i n g r d _ d e t a i l . A v a i l a b l e _ S t o c k ) = 0 ) )
);
END
80 Carl Abernethy
Appendix E
Pricing Algorithm
Listing E.2: Initial function to create required variables for the recursive function (Listing E.1).
p u b l i c d o u b l e c a l c u l a t e D i s c o u n t e d P r i c e ( i n t aOrderID , j a v a . u t i l . Date o r d e r D a t e ) {
// VARIABLES DECLARED: REMOVED TO REDUCE SIZE
try {
db = new Database ( ) ;
conn = db . g e t C o n n e c t i o n ( ) ;
// NOW CALCULATE REDUCTION
// F i r s t f i n d a l l t h e a v a i l a b l e o f f e r s
// − Checking t h e o r d e r d a t e and a v a i l a b i l i t y o f t h e o f f e r
// − Checking t o s e e t h a t a t l e a s t 1 p r o d u c t e x i s t s i n o f f e r s e t from o r d e r
a v a i l a b l e O f f e r s = db . e x e c u t e S e l e c t Q u e r y ( " " +
"SELECT DISTINCT o f f e r . Offer_ID " +
"FROM ( s u b _ o r d e r _ p r o d u c t s " +
"INNER JOIN sub_order ON s u b _ o r d e r _ p r o d u c t s . Sub_Order_ID = sub_ord er . Sub_Order_ID ) " +
"INNER JOIN ( ( ( o f f e r INNER JOIN o f f e r _ a v a i l a b i l i t y " +
"ON o f f e r . Offer_ID = o f f e r _ a v a i l a b i l i t y . Offer_ID ) " +
"INNER JOIN o f f e r _ s e t s ON o f f e r . Offer_ID = o f f e r _ s e t s . Offer_ID ) " +
"INNER JOIN s e c t i o n _ m e a l s ON o f f e r _ s e t s . Set_ID = s e c t i o n _ m e a l s . S e c tion _I D ) " +
"ON s u b _ o r d e r _ p r o d u c t s . Product_ID = s e c t i o n _ m e a l s . Product_ID " +
"WHERE ( ( ( o f f e r _ a v a i l a b i l i t y . From_time)<=' "+o r d e r D a t e+" ' ) " +
"AND ( ( o f f e r _ a v a i l a b i l i t y . To_time)>=' "+o r d e r D a t e+" ' ) " +
"AND ( ( o f f e r _ a v a i l a b i l i t y . Day_ID)=DayOfWeek ( ' "+o r d e r D a t e+" ' ) ) " +
"AND ( ( sub_order . Order_ID)= "+aOrderID+" ) ) " ) ;
// Now c r e a t e t h e o f f e r o b j e c t s
// 2 t y p e s o f o f f e r s 1) Buy n from A and g e t m from B % o f f
// 2) Buy l from A, n from B and m from C f o r £x
int offerCount = 0;
// Check t o s e e how many o f f e r s t h e r e a r e
81
RESTAURANT MANAGEMENT SYSTEM CHAPTER E. Pricing Algorithm
w h i l e ( a v a i l a b l e O f f e r s . n e x t ( ) ) o f f e r C o u n t ++;
// Go back t o b e g i n n i n g
availableOffers . beforeFirst ();
// Return i f no o f f e r s v a l i d
i f ( o f f e r C o u n t == 0 ) {
...
}else{
// Get a l i s t o f a l l t h e s e t s i n t h e p a r t i c u l a r o f f e r i d under t h e o r d e r
pstmt = conn . p r e p a r e S t a t e m e n t ( " " +
"SELECT DISTINCT t y p e . Name , o f f e r _ s e t s . Set_ID " +
"FROM ( sub_order " +
"INNER JOIN s u b _ o r d e r _ p r o d u c t s
ON sub_order . Sub_Order_ID = s u b _ o r d e r _ p r o d u c t s . Sub_Order_ID ) " +
"INNER JOIN ( s e c t i o n _ m e a l s " +
"INNER JOIN ( ( o f f e r " +
"INNER JOIN t y p e ON o f f e r . Type_ID = t y p e . Type_ID ) " +
"INNER JOIN o f f e r _ s e t s ON o f f e r . Offer_ID = o f f e r _ s e t s . Offer_ID ) " +
"ON s e c t i o n _ m e a l s . S e c tion _I D = o f f e r _ s e t s . Set_ID ) " +
"ON s u b _ o r d e r _ p r o d u c t s . Product_ID = s e c t i o n _ m e a l s . Product_ID " +
"WHERE ( ( ( sub_order . Order_ID)= "+aOrderID+" ) AND ( ( o f f e r _ s e t s . Offer_ID ) = ? ) ) " ) ;
// An a r r a y o f o f f e r s t o a p p l y
// ( The o f f e r c o u n t w i l l be t h e max number o f c h i l d r e n f o r e a c h node )
O f f e r O b j e c t [ ] o f f e r A r r a y = new O f f e r O b j e c t [ o f f e r C o u n t ] ;
// S e t i n i t i a l s e t c o u n t t o 0
i n t setCount = 0 ;
// S e t i n i t i a l o f f e r Number t o 0
i n t offerNumber = 0 ;
// Loop t h r o u g h e a c h o f f e r 1 by 1
int currentOfferID = 0;
o f f e r = new O f f e r ( ) ;
while ( a v a i l a b l e O f f e r s . next ( ) ) {
// C l e a r p a r a m e t e r s i n p r e p a r e d s t a t e m e n t
pstmt . c l e a r P a r a m e t e r s ( ) ;
// S e t f i r s t p a r a m e t e r t o t h e o f f e r i d
c u r r e n t O f f e r I D = a v a i l a b l e O f f e r s . g e t I n t ( " Offer_ID " ) ;
o f f e r . getOffer ( currentOfferID ) ;
pstmt . s e t I n t ( 1 , c u r r e n t O f f e r I D ) ;
r s e t O f f e r = pstmt . e x e c u t e Q u e r y ( ) ;
setCount = 0 ;
w h i l e ( r s e t O f f e r . n e x t ( ) ) s e t C o u n t ++;
rsetOffer . beforeFirst ();
r s e t O f f e r . next ( ) ;
i f ( r s e t O f f e r . g e t S t r i n g ( "Name" ) . compareTo ( " O f f e r 1 " ) == 0 && s e t C o u n t == 1 ) {
i n t s e t I D 1 = r s e t O f f e r . g e t I n t ( " Set_ID " ) ;
// Example : Buy 1 g e t 1 f r e e
o f f e r A r r a y [ o f f e r N u m b e r ] = new O f f e r 1 O b j e c t ( aOrderID , s e t I D 1 , s e t I D 1 ,
o f f e r . getNSet1 ( ) , o f f e r . getNSet2 ( ) , o f f e r . ge tPe rc e n t ( ) , c u r r e n t O f f e r I D ) ;
o f f e r N u m b e r++;
} e l s e i f ( r s e t O f f e r . g e t S t r i n g ( "Name" ) . compareTo ( " O f f e r 1 " ) == 0 && s e t C o u n t == 2 ) {
. . . // SIMILAR TO FIRST IF
} e l s e i f ( r s e t O f f e r . g e t S t r i n g ( "Name" ) . compareTo ( " O f f e r 2 " ) == 0 & s e t C o u n t == 1 ) {
. . . // SIMILAR TO FIRST IF
} e l s e i f ( r s e t O f f e r . g e t S t r i n g ( "Name" ) . compareTo ( " O f f e r 2 " ) == 0 & s e t C o u n t == 2 ) {
. . . // SIMILAR TO FIRST IF
} e l s e i f ( r s e t O f f e r . g e t S t r i n g ( "Name" ) . compareTo ( " O f f e r 2 " ) == 0 & s e t C o u n t == 3 ) {
. . . // SIMILAR TO FIRST IF
}
// o f f e r N u m b e r ++;
} // w h i l e
// Once w h i l e l o o p c o m p l e t e
// Have an a r r y o f O f f e r s need t o a p p l y them o f f e r s i n numerous ways
o r d e r R s e t = db . e x e c u t e S e l e c t Q u e r y ( " " +
"SELECT Product_ID , Sub_Order_Product_ID , p r i c e " +
"FROM sub_ord er INNER JOIN s u b _ o r d e r _ p r o d u c t s
ON sub_order . Sub_Order_ID = s u b _ o r d e r _ p r o d u c t s . Sub_Order_ID " +
"WHERE ( ( ( sub_order . Order_ID)= "+aOrderID+" ) ) " +
"ORDER BY s u b _ o r d e r _ p r o d u c t s . p r i c e DESC" ) ;
i n t count = 0 ;
w h i l e ( o r d e r R s e t . n e x t ( ) ) c o u n t++;
orderRset . b e f o r e F i r s t ( ) ;
// Each p r o d u c t w i t h p r i c e
// The e x t r a one w i l l be t h e p r i c e
i n t [ ] [ ] p r o d u c t = new i n t [ c o u n t + 1 ] [ 3 ] ;
82 Carl Abernethy
RESTAURANT MANAGEMENT SYSTEM CHAPTER E. Pricing Algorithm
i n t index = 0 ;
while ( orderRset . next ( ) ) {
p r o d u c t [ i n d e x ] [ 0 ] = o r d e r R s e t . g e t I n t ( " Product_ID " ) ;
product [ index ] [ 1 ] = ( i n t ) ( orderRset . getDouble ( " P r i c e " ) ∗ 1 0 0 . 0 ) ;
p r o d u c t [ i n d e x ] [ 2 ] = o r d e r R s e t . g e t I n t ( " Sub_Order_Product_ID " ) ;
i n d e x ++;
} // w h i l e
product [ product . length − 1 ] [ 0 ] = 0 ; product [ product . length − 1 ] [ 1 ] = 0 ;
discountedPriceInt = 0;
recursiveMethod ( offerArray , product ) ;
} // w h i l e
return ( ( double ) d i s c o u n t e d P r i c e I n t / 1 0 0 . 0 ) ;
} catch ( Exception e ){
throw e ;
}finally{
...
} // f i n a l l y
}
83 Carl Abernethy