Amaan Capstonefinal
Amaan Capstonefinal
In-Semester Capstone
Project Report on
Canteen Management System
Submitted by –
-Ganesh Sante
Roll no –
Amaan Shah(164)
Ganesh Sante(160)
(Semester-I)
Year 2024-25
UML Diagrams 17
Flow Chart 18
Data Flow Diagram 18
Entity Relationship Diagram 19
Description of Entities 20
4. Testing and Validation 21
Code Efficiency 22
Testing Approach 24
Unit Testing 25
Integration Testing 25
5.User Manual 26
User Documentation 27
Outputs 29
Code Snippets 30
6.Conclusion 31
Conclusion 31
Limitations 31
Future Scope 32
1. Introduction :
Introduction :
The Canteen Management System is a comprehensive and efficient solution developed using
Java to manage and streamline the operations of a canteen. This system is designed to automate
tasks such as food ordering, order and their bill details, and customer tracking, significantly
reducing the manual effort involved in managing these processes.
● Customer Ordering: Allows customers to place orders from a menu and track their
orders.
● Billing System: Automatically calculates the total cost of orders.
● Admin Panel: Allows administrators to add or remove items from the menu, update
prices, and monitor daily sales.
By implementing this system, the canteen management can achieve better organization,
improved efficiency, and enhanced customer service, contributing to an overall better experience
for both staff and customers.
Purpose :
The primary purpose of the Canteen Management System is to automate and optimize the day-
to-day operations of a canteen, ensuring smooth management of food orders, billing.
1. Enhance Efficiency: Automate routine tasks such as order taking, billing and order
tracking to reduce manual errors and improve the speed of service.
2. Simplify Management: Provide canteen administrators with an intuitive interface to
manage menus, pricing, inventory, and staff assignments in real-time.
3. Improve Customer Experience: Allow customers to place orders quickly, track the
status of their orders, and make payments efficiently, resulting in a better overall
experience.
4. Control Inventory: Provide a system to track stock levels, prevent shortages, and ensure
timely reordering of supplies, which can help maintain smooth operations.
Ultimately, this Canteen Management System aims to reduce operational complexities, increase
productivity, and foster better communication between customers, staff, and administrators,
leading to a more organized and profitable canteen.
Objective :
The primary objectives of the Canteen Management System project are to:
These objectives set clear goals for what the Canteen Management System should achieve and
emphasize improving efficiency, user experience, and decision-making through automation and
data-driven insights. These objectives will also guide your development process and help
measure the success of the project.
Working of project
In our system, once a customer has added items to their cart and is ready to place an order, the
following process is followed:
Cart Overview: All selected items, including their names, quantities, and individual prices, are
displayed in the cart for review. The total cost is calculated based on the items added.
Order Placement: After reviewing the cart, the customer clicks the "Place Order" button to
initiate the ordering process.
Order Processing: Upon placing the order, the status of each item in the order is updated to
"Processing". This indicates that the order is being prepared and is not yet complete. The system
will continue to track the progress of the order during this phase.
Order Completion: Once the order is successfully processed and completed, it will be moved to
the Order History section, where the status of the order will be updated to "Completed". This
signifies that the order has been successfully delivered or fulfilled.
Order History: The Order History section keeps a record of all completed orders, where the
status of each order will show as "Completed", along with relevant details like items ordered,
quantities, and the total cost at the time of completion.
Advantages:
● Simplified User Experience: No complex invoices; customers only see the order status
(processing/completed), making the process clear and easy.
● Real-Time Tracking: Customers can track the status of their order at any time.
● Reduced Administrative Overhead: No need to generate and manage invoices, which
simplifies the system and saves time.
● Scalable: The system is easier to scale since it focuses on order statuses instead of billing
details.
● Fewer Billing Errors: With no invoices, there’s less chance of billing mistakes.
Disadvantages:
● Lack of Detailed Documentation: No formal invoice could lead to confusion about pricing or
itemized costs.
● Limited Financial Tracking: Missing invoices might make it harder for customers and
businesses to track finances or generate reports.
● No Legal Documentation: Invoices are often required for returns, warranties, or proof of
purchase.
● Customer Confusion: Customers may not understand the breakdown of costs, like taxes and
shipping fees.
● Limited Integration with Accounting Systems: Without invoices, integrating with accounting
tools could be challenging.
2. System Study
Requirement Analysis: -
Functional Requirements:
● User login/signup with valid credentials.
● Admin panel for managing item listings.
● Items search from menu with prices..
● Detailed item view including images.
Non-Functional Requirements:
● Scalability: Handle a growing number of users and their choices.
● Performance: Ensure minimal latency during searches and updates.
● Security: Protect user data with authentication and encrypted storage.
● User Experience: Provide an intuitive and responsive interface.
3. Analysis and Design
Software Requirement
Java :
Swing:
Swing is used for building the Graphical User Interface (GUI) of the application. It provides a set
of components to create windows, buttons, text fields, and other elements that users interact with.
Swing is particularly useful for building desktop applications, providing a responsive and user-
friendly interface.
MySQL:
1. Code Efficiency
Definition: Code efficiency refers to how well the code performs in terms of resource utilization
(e.g., CPU, memory, disk space) while achieving its intended purpose. Efficient code minimizes
resource consumption and performs optimally under varying conditions.
Key Aspects:
● Time Complexity: The amount of time a program takes to run in relation to the size of
the input (often expressed in Big-O notation, like O(n), O(log n)).
● Space Complexity: The amount of memory the program consumes relative to the input
size.
● Optimization: Refactoring code or algorithms to improve speed, reduce memory
consumption, or handle larger datasets efficiently.
● Profiling: Using tools to measure the program’s resource usage to pinpoint bottlenecks or
inefficiencies.
2. Testing Approach
Definition: The testing approach refers to the structured methodology adopted for verifying and
validating the software throughout its development lifecycle. It outlines how testing will be
executed to ensure the software meets its requirements and functions as expected.
Key Aspects:
3. Unit Testing
Definition: Unit testing is the process of testing individual components or units of code (such as
functions or methods) in isolation from the rest of the system to ensure that each unit functions
correctly.
Key Aspects:
● Isolation: Ensuring that each unit is tested independently, often using techniques like
mocking or stubbing to simulate external dependencies (e.g., databases, APIs).
● Granularity: Unit tests are generally small, testing one specific behavior or piece of
functionality of the component.
● Edge Cases: These tests should not only cover typical use cases but also edge cases, such
as invalid inputs or boundary conditions.
● Automation: Unit tests should be automated and part of the CI pipeline so that they run
automatically whenever code changes.
4. Integration Testing
Definition: Integration testing involves testing the interaction between different modules,
services, or components in a system to ensure they work together as expected. Unlike unit tests,
which focus on isolated components, integration tests check how well parts of the application
interact with one another.
Key Aspects:
Component Interaction: It ensures that different components of the system (e.g., frontend-
backend, microservices, database interactions) function correctly when combined.
End-to-End Testing: A type of integration testing where the entire system or a significant part
of it is tested from start to finish, often simulating real-world user behavior.
Real Dependencies: Unlike unit tests where external systems might be mocked, integration tests
often involve using real systems or simulated production environments (like a test database or
API).
API Testing: Verifying the correct behavior of APIs by sending real requests and receiving real
responses, checking for correct status codes, data formats, and error handling.
5. User Manual
Code snippet :
RegistrationForm.java :
import java.awt.*;
import java.awt.event.ActionEvent;
import
java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import
java.sql.PreparedStatement;
import java.sql.SQLException;
import javax.swing.*;
public RegistrationForm() {
setTitle("Registration Form");
setSize(500, 350);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(10, 10, 10, 10);
submitButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String username = usernameField.getText();
String sapId = sapIdField.getText();
String phoneNo = phoneNoField.getText();
String password = new
String(passwordField.getPassword());
try {
registerUser(username, sapId, phoneNo,
password);
JOptionPane.showMessageDialog(null,
"Registration successful!");
new LoginPage();
dispose();
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error:
" + ex.getMessage());
}
}
});
loginButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
new LoginPage();
dispose();
}
});
gbc.gridx = 0;
gbc.gridy = 0;
add(usernameLabel, gbc);
gbc.gridx = 1;
add(usernameField, gbc);
gbc.gridx = 0;
gbc.gridy = 1;
add(sapIdLabel, gbc);
gbc.gridx = 1;
add(sapIdField, gbc);
gbc.gridx = 0;
gbc.gridy = 2;
add(phoneNoLabel, gbc);
gbc.gridx = 1;
add(phoneNoField, gbc);
gbc.gridx = 0;
gbc.gridy = 3;
add(passwordLabel, gbc);
gbc.gridx = 1;
add(passwordField, gbc);
gbc.gridx = 0;
gbc.gridy = 4;
add(loginButton, gbc);
gbc.gridx = 1;
add(submitButton, gbc);
setVisible(true);
}
// SAP validate
if (!sapId.matches("^[a-zA-Z0-9]{11}$")) {
JOptionPane.showMessageDialog(null, "SAP ID must be
11 characters and alphanumeric.");
return false;
}
// Phone validate
if (!phoneNo.matches("^\\d{10}$")) {
JOptionPane.showMessageDialog(null, "Phone number
must be a valid 10-digit number.");
return false;
}
// Password validate
if (!password.matches("^(?=.*[0-9])(?=.*[A-Z])(?=.*[@#$
%^&+=!])(?=\\S+$).{8,}$")) {
JOptionPane.showMessageDialog(null, "Password must
be at least 8 characters long and contain at least one digit,
one uppercase letter, and one special character.");
return false;
}
return true;
}
LoginPage.java :
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.swing.*;
public LoginPage() {
setTitle("Login Page");
setSize(400, 300);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(10, 10, 10, 10);
registerButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new RegistrationForm();
dispose();
}
});
loginButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String username = usernameField.getText();
String password = new
String(passwordField.getPassword());
if (username.isEmpty() || password.isEmpty()) {
JOptionPane.showMessageDialog(null, "Please
fill in all fields.");
} else {
try {
if (checkCredentials(username,
password)) {
JOptionPane.showMessageDialog(null,
"Login successful!");
new CanteenManagementSystemUI();
dispose();
} else {
JOptionPane.showMessageDialog(null,
"Invalid username or password.");
}
} catch (Exception ex) {
JOptionPane.showMessageDialog(null,
"Error: " + ex.getMessage());
}
}
}
});
gbc.gridx = 0;
gbc.gridy = 0;
add(usernameLabel, gbc);
gbc.gridx = 1;
add(usernameField, gbc);
gbc.gridx = 0;
gbc.gridy = 1;
add(passwordLabel, gbc);
gbc.gridx = 1;
add(passwordField, gbc);
gbc.gridx = 1;
gbc.gridy = 2;
gbc.gridwidth = 1;
add(loginButton, gbc);
gbc.gridx = 0;
gbc.gridy = 2;
gbc.gridwidth = 1;
add(registerButton, gbc);
setVisible(true);
}
CanteenManagementSystemUI.java :
import java.awt.*;
import java.sql.*;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Stack;
import javax.swing.*;
class MenuItem {
String name;
double price;
ImageIcon image;
MenuItem(String name, double price, ImageIcon image) {
this.name = name;
this.price = price;
this.image = image;
}
@Override
public String toString() {
return name + " - Rs. " + price;
}
}
class CartItem {
MenuItem menuItem;
int quantity;
@Override
public String toString() {
return menuItem.name + " (x" + quantity + ") - Rs. " +
getTotalPrice();
}
}
class Order {
String item;
String status;
Order(String item) {
this.item = item;
this.status = "Processing";
}
@Override
public String toString() {
return item + " - Status: Completed";
}
}
public CanteenManagementSystemUI() {
menuItems = new ArrayList<>();
orderHistory = new Stack<>();
currentOrders = new LinkedList<>();
cartItems = new ArrayList<>();
initializeDatabase();
initializeMenu();
loadCurrentOrders();
setLayout(new BorderLayout());
buttonPanel.add(menuButton);
buttonPanel.add(processOrderButton);
buttonPanel.add(orderHistoryButton);
add(buttonPanel, BorderLayout.WEST);
cartList.setSelectionMode(ListSelectionModel.SINGLE_SEL
ECTION); JScrollPane cartScrollPane = new
JScrollPane(cartList); cartPanel.add(new
JLabel("Cart"), BorderLayout.NORTH);
cartPanel.add(cartScrollPane, BorderLayout.CENTER);
JButton placeOrderButton = new JButton("Place Order");
cartPanel.add(placeOrderButton, BorderLayout.SOUTH);
menuPanel.add(menuScrollPane, BorderLayout.CENTER);
menuPanel.add(cartPanel, BorderLayout.EAST);
cards.add(menuPanel, "Menu");
processNextButton.addActionListener(e ->
processNextOrder());
add(cards, BorderLayout.CENTER);
itemPanel.setBorder(BorderFactory.createLineBorder(Color.GRAY,
1));
itemPanel.setPreferredSize(new Dimension(170, 20));
itemImageLabel.setHorizontalAlignment(JLabel.CENTER);
itemPriceLabel.setHorizontalAlignment(JLabel.CENTER);
itemPanel.add(itemImageLabel, BorderLayout.NORTH);
itemPanel.add(detailsPanel, BorderLayout.CENTER);
menuItemsPanel.add(itemPanel);
}
cartList.addListSelectionListener(e -> {
if (!e.getValueIsAdjusting()) {
int selectedIndex = cartList.getSelectedIndex();
if (selectedIndex >= 0) {
showUpdateCartDialog(selectedIndex);
}
}
});
setVisible(true);
}
while (resultSet.next()) {
String name = resultSet.getString("item_name");
double price =
resultSet.getDouble("item_price");
String imagePath =
resultSet.getString("item_image");
ImageIcon icon = new ImageIcon(imagePath);
icon = resizeImage(icon, 50, 50);
menuItems.add(new MenuItem(name, price, icon));
}
} catch (SQLException e) {
e.printStackTrace();
JOptionPane.showMessageDialog(this, "Error loading
menu items from the database.");
}
}
orderListModel.clear();
while (resultSet.next()) {
String item = resultSet.getString("item_name");
orderListModel.addElement(item + " - Status:
Processing");
currentOrders.add(new Order(item));
}
} catch (SQLException e) {
e.printStackTrace();
JOptionPane.showMessageDialog(this, "Error loading
current orders from the database.");
}
}
cartItems.clear();
updateCartList();
addToOrderHistory(order);
Outputs:
Registration form:
Login Page:
Menu:
6. Conclusion
In conclusion, the project successfully implemented an order management system using Java,
Swing, and MySQL. The main objectives were achieved, which included creating a functional
cart, processing orders, and tracking order statuses from "Processing" to "Completed." The
project provided a comprehensive approach to managing orders without generating invoices but
still allowing customers to track the progress of their orders through the interface. By leveraging
Java for backend processing, Swing for the user interface, and MySQL for data storage, the
system operates smoothly and efficiently, ensuring that all orders are recorded and updated in
real-time. The project also emphasized the importance of user experience by providing an
intuitive and clear interface for customers to interact with.
Limitations:
1. Lack of Detailed Documentation: No formal invoice could lead to confusion about
pricing or itemized costs.
2. Limited Financial Tracking: Missing invoices might make it harder for customers and
businesses to track finances or generate reports.
3. No Legal Documentation: Invoices are often required for returns, warranties, or proof of
purchase.
4. Customer Confusion: Customers may not understand the breakdown of costs, like taxes
and shipping fees.
5. Limited Integration with Accounting Systems: Without invoices, integrating with
accounting tools could be challenging.
Future Scope:
Overcoming all the limitations and adding QR code menu functionality by which user can scan
the qr code an place the order easily