Final Report C++
Final Report C++
Not all countries are as advanced as China. In our home country, Indonesia,
only a small portion of restaurants have implemented this program which makes
restaurant owners have to hire more servers to take orders from customers. From this
phenomena, we decided that we would like to further study the ordering program
used in China so that we could bring it back to our country and implement it in every
restaurant in Indonesia.
2. Program Analysis
2.1 Key Issues for System
In this system, the data models are logically organized into individual classes that
represent key entities in a restaurant environment, such as users, menu items, orders,
and tables. Each class contains data members that reflect its real-world attributes. For
example, the User class includes id, username, password, and role to distinguish
between different types of users. The MenuItem class holds information like id,
name, price, and category, allowing items to be grouped and displayed efficiently.
The Order class maintains a list of selected MenuItem objects, the associated tableId,
the total price, and a status indicator. The Table class tracks the table's id, number of
seats, and occupancy status. This careful arrangement of data members ensures that
each object encapsulates all the necessary information, providing a clear and
maintainable structure for the application logic.
3. Global Functions
Global functions are used sparingly in this project and are reserved for utility tasks
that do not logically belong to any single class. These functions provide support for
commonly used operations such as calculating the total cost of an order, validating
user credentials, or formatting currency values for display. For example, a global
function like calculateTotal can accept a list of MenuItem objects and return the sum
of their prices, which is useful for computing the order total in both the UI and the
backend. To avoid naming conflicts and improve organization, these global functions
can be grouped into a Utils namespace. This separation allows them to be reused
across different components of the system without violating object-oriented
principles or cluttering class definitions with unrelated methods.
4. Files
The project is organized into modular folders for clarity and maintainability. The
main.cpp file launches the application, while the ui/ folder contains interface
components like login, menu, order, and table views. The models/ folder holds core
classes such as User, MenuItem, Order, and Table, each managing specific restaurant
data and behavior. Database operations are handled by the DatabaseManager class,
found in both the models/ and database/ folders. This structure cleanly separates UI,
logic, and data access.
3. Technical Routine
3.1 Runtime Environment
Windows 11, Qt Creator 6.9.1, C make 4.0.2
i) “User” class
ii) “Admin” class
iii) “Staff” class
iv) “Customer” class
v) “Menu” class
vi) “MenuItem” class
2) File Processing Workflow
3) UI design
1. Order Classification
Order categories, where you can view all your orders and know which ones are ready,
served, pending, and cancelled.
2) Table Classification
3) Login System
There was supposed to be a login system, but as you can tell, we failed with the UI,
although we have the code ready.
In the user class, the constructor initializes a user object with specific details
such as their ID, username, password, role, and an optional parent object used in Qt's
object hierarchy. After assigning the basic information, it sets up the user's default
permissions based on their role (customer, server, admin).
The table class consists of a setter method. It is used to update the table's
number and seating capacity. Each method first checks if the new value is different
from the current one to avoid unnecessary updates. If the value has changed, it
updates the member variable and emits a corresponding Qt signal .
The order class classifies the type of order. The first one creates a default
order with no specific ID, table assignment, or server. It sets the order's status to
"Pending" and records the current date and time as the order time. The second
constructor allows for more specific initialization by accepting an order ID, a table
ID, and a pointer to the server (User) handling the order. It also sets the status to
"Pending" and timestamps the order with the current time. Both constructors ensure
that every new order starts in a consistent initial state, ready to be processed.
These two functions are setter methods in the MenuItem class, used to update
the name and description of a menu item. Each method first checks whether the new
value is different from the existing one to avoid redundant updates. If a change is
detected, the internal variable is updated and a corresponding Qt signal
(nameChanged or descriptionChanged) is emitted. These signals are used to inform
other parts of the application—typically the user interface—that the data has
changed, allowing the display to update automatically. This ensures real-time
synchronization between the backend data and the frontend view.
2. UI Design
Below the toolbar, a QTableWidget is created to display a list of tables. It has five
columns: ID, Number, Capacity, Status, and Current Order. The table is set up to
stretch columns to fit the window size, allow only single row selection, and prevent
direct editing of cells. Finally, both the toolbar and the table are added to the main
layout (mainLayout), integrating them into the overall window or view. This section
of code provides the core UI for viewing and managing restaurant tables efficiently.
This code creates the user interface for managing orders in the application
using Qt widgets. It starts with a QTableWidget called orderTable, which is
configured to display six columns: ID, Table, Time, Status, Items, and Total. These
columns present key details of each order. The table is set to automatically stretch
columns to fit the window width, allow only full row selection, and disable in-place
editing of cells ensuring a clean, consistent, and controlled user experience.
Below the order table, a horizontal layout (QHBoxLayout) is created for action
buttons: New Order, Edit Order, and Delete Order. These buttons let users manage
the order list interactively. Finally, a QLabel named statusLabel is added at the
bottom of the layout, aligned to the center, which can be used to show messages or
updates ( Order saved, No order selected). Overall, this code builds a structured and
interactive section of the UI for viewing and handling restaurant orders.
This code defines the user interface for managing the menu items in a
restaurant system. It begins by creating a dropdown filter (QComboBox) called
categoryFilter, which allows users to filter menu items based on their category.
Initially, it includes the option "All Categories", enabling the user to view all items
regardless of classification. A label and the filter dropdown are added to a horizontal
layout called filterLayout, which is then placed into the main layout (mainLayout).
At the bottom, a horizontal layout for buttons is added with Add Item, Edit
Item, and Delete Item options. These buttons allow users to manage the menu by
adding new entries, updating existing ones, or removing items. Together, this UI
section enables efficient and user-friendly management of the restaurant's menu
catalog.
4. Programming Progress
Phases of Mission Period Planned Completion Actual Completion
Determining the topic 2025.06.1-2025.06.04 Survey the interesting Finish our proposal
and submit the topics, and write the and decide the divide
proposal proposal. of work.
Build up the basic 2025.06.05-2025.06.07 Start on user class Finished on both
classes and derived and table class. user and table class.
classes.
Finishing the rest of 2025.06.07-2025.07.10 Finish the order, Finished order,
classes menuitem, and menuitem, and
menu class menu class.
Making UI on QT 2025.06.08-2025.06.11 Making the UI. Only some part of
the code can
actually be
implemented in the
UI while the rest
cannot be accessed
in the UI.
5. Testing Report
5.1 Function testing
1.Menu classification
2. Menu classification
3. Table classification
6. Personal Summary
After putting in so much time and effort, it was truly rewarding to see our
program working well in the end. This project has shown me how meaningful and
efficient teamwork can be, and I look forward to more opportunities for collaborative
projects in the future, where we can challenge ourselves even further.
Richie
In this last project, I have learned many new things, from new code functions
to learning how to make a UI for an app. Although this project is nothing but a flaw
and failure, we believe that this idea possesses a good potential and we hope that we
could revisit this idea and project one day in the future with more preparation and
knowledge and we hope to be able to make this project successful.\
7. Reference