0% found this document useful (0 votes)
8 views40 pages

Shopping Mall Management System Report

The document is a project report for a Shopping Mall Management System (SMMS) developed by Divya Prakash as part of the BCA degree requirements. It outlines the project's objectives, system analysis, design methodology, and the benefits of automating mall operations to improve efficiency and accuracy. The report includes sections on feasibility studies, system design, and testing, emphasizing the importance of a secure and user-friendly interface for managing retail activities.

Uploaded by

Sarveshwar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views40 pages

Shopping Mall Management System Report

The document is a project report for a Shopping Mall Management System (SMMS) developed by Divya Prakash as part of the BCA degree requirements. It outlines the project's objectives, system analysis, design methodology, and the benefits of automating mall operations to improve efficiency and accuracy. The report includes sections on feasibility studies, system design, and testing, emphasizing the importance of a secure and user-friendly interface for managing retail activities.

Uploaded by

Sarveshwar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Shopping Mall Management System

A Project Report

Submitted in partial fulfillment of the requirements for the

Award of degree BCA

2023 – 2026

Submitted by :- Guided by :
Preeti
Divya Prakash Taneja

BHARATI VIDYAPEETH DEEMED UNIVERSITY SCHOOL OF DISTANCE EDUCATION

Academic Study Center - BVIMR, New Delhi An

ISO 9001:2008 Certified Institute

NAAC Accredited Grade “A” University


Student Undertaking

Certificate of Originality

I Divya Prakash BCA Sem-4 would like to declare that the project report entitled “ Shopping Mall

Management System “ Submitted to Bharati Vidyapeeth University Pune, School of

Distance Education Pune,Academic Study Centre BVIMR New Delhi in partial fulfillment of

the requirement for the award of the degree. It is an original work carried out by me under

the guidance of Preeti Taneja. All respected guides, faculty member and other sources have

been properly acknowledged and the report contains no plagiarism. To the best of my

knowledge and belief the matter embodied in this project is a genuine work done by me

and it has been neither submitted for assessment to the University nor to any other

University for the fulfillment of the requirement of the course of study.

Student Name with Signature


Acknowledgement

First of all I would like to Thanks the Director of BVUSDE shri Dr . Amarjit R Deshmukh sir, For giving me
the opportunity to within the Institute.

I also would like to thanks all the people that worked along with me in PSSROJECT on “Shopping Mall

Management System “. With their patience and openness has created an enjoyable working environment.

I am extremely greatfull to my department staff members, precious faculty members and friends who helped
me in successful completion of this project.

DIVYA PRAKASH

(2328100179)
Index
Sr. No. Chapters Page
No.

1 Introduction 1-5

1.1 Introduction about Project 1

1.2 Need for Computerization 1-2

1.3 Software Objectives 2-3

1.4 Importance of the Work 3-5

2 System Analysis 6-8

2.1 Feasibility Study 6

2.2 Analysis Methodology 7

2.3 Choice of Platform 8

3 System Design 9-14

3.1 Design Methodology 9-10

3.2 Data Flow Diagrams (DFD) 10-11

3.3 Entity Relationship Diagram (ERD) 12

3.4 Input Design 13

3.5 Output Design 13-14

4 Testing and Implementation 15-17

4.1 Types of Testing 15

4.2 Unit Testing 15


4.3 Module Testing 15-16

4.4 System Testing 16

4.5 Alpha and Beta Testing 16

4.6 White-box & Black-box Testing 16-17

4.7 Implementation Strategy 17

5 Conclusion and References 18-20

5.1 Conclusion 18

5.2 Limitations of the Project 19

5.3 Future Scope 19

5.4 Hardware and Software Requirements 20

5.5 References 20

6 Annexures 21-35

6.1 Menu Flow Diagram 21

6.2 Input Forms 21

6.3 Output Screens (Sample Data) 21-22

6.4 Database Schema and SQL 22-23

6.5 Screen Design (GUI Forms) 24-35


CHAPTER 1 – INTRODUCTION
1.1 Introduction about Project

In today’s fast-paced commercial environment, managing a shopping mall manually has become
increasingly challenging due to the growing scale of operations, customer expectations, and
variety of retail outlets involved. The Shopping Mall Management System (SMMS) is a
comprehensive software solution designed to automate and streamline the internal operations
of a shopping mall. It offers a centralized platform for managing shops, inventory, billing, and
administrative tasks across the mall efficiently and securely.

The system aims to integrate multiple modules like shopkeeper registration, product listings,
stock management, real-time billing, and sales reports under one user-friendly interface. The
SMMS is developed using Java (Swing GUI) and MySQL, allowing seamless connectivity,
structured data storage, and an interactive graphical user interface for both Admins and
Shopkeepers.

The Admin has full control of the system — managing products, tracking sales, and viewing
inventory — while the Shopkeeper can generate bills, view stock, and sell products to customers.
The system drastically reduces paperwork, minimizes human error, and increases productivity by
leveraging automation.

Security is paramount in this application. Password-protected logins, role-based access controls,


and database integrity checks ensure that sensitive business data remains protected.
Furthermore, it includes audit logs and billing summaries to promote transparency,
accountability, and quick decision-making.

By digitizing mall operations, this system enhances service delivery, optimizes inventory flow,
and enables mall authorities to handle a high volume of transactions in an efficient manner. It
ensures scalability, accuracy, and robustness required for the modern retail ecosystem.

1.2 Need for Computerization of the System


In large-scale shopping malls, a wide range of activities such as inventory tracking, billing, sales
reporting, and vendor coordination are performed regularly. Managing these functions
manually can lead to several challenges, including delayed billing, overstock or stock-out issues,
miscommunication between management and shopkeepers, and data inconsistency. The need
for computerization arises from the following benefits:

1
1. Operational Efficiency – The system can process transactions, generate bills, and
manage inventory much faster than traditional manual systems.

2. Error Reduction – By automating repetitive tasks, human error is significantly reduced,


ensuring higher accuracy in stock records and billing.

3. Centralized Control – Admin can oversee multiple shops from a single interface, making
it easy to monitor inventory and performance.

4. Enhanced Security – The system implements authentication mechanisms to restrict


unauthorized access and protects critical business data.

5. Real-time Reporting – With automated logs and sales reports, business insights can be
generated instantly for informed decision-making.

6. Scalability – The software can easily be upgraded or customized to support additional


stores, users, or services as the mall grows.

The Shopping Mall Management System bridges the gap between manual inefficiencies and
modern-day retail demands by offering a fast, secure, and scalable platform.

1.3 What the Software Will Accomplish


The Shopping Mall Management System is designed to replace time-consuming manual
operations with an integrated software solution that:

• Allows Admin users to:

o Manage shopkeeper profiles

o View and update product lists

o Monitor inventory levels o

View detailed sales reports

• Allows Shopkeepers to:

o Log in securely o Manage

products within their stores o

Create customer bills with real-

time calculations o

2
Automatically update stock post-

sale

• Generates real-time reports for: o Total

sales per day/month

o Inventory levels o Product-

wise performance

• Prevents unauthorized access through: o

Username/password logins o Role-

based access to features

• Simplifies billing through: o Easy item

selection o Real-time total calculation o

Auto-printable receipt generation

Overall, the software will ensure that mall operations are more organized, secure, fast, and
business-oriented, providing all stakeholders with a professional experience.

1.4 Importance of the Work


The Shopping Mall Management System is an essential project in the context of modern retail
infrastructure and business intelligence. Its importance can be outlined as:

1. Automation of Routine Tasks


Reduces manual workload for shopkeepers and management through features like
autoinventory update, billing, and reporting.

2. Error-Free Transactions
Ensures accurate billing and stock deduction, reducing chances of calculation mistakes
or stock mismatch.

3. Secure Data Handling


All sensitive data — such as product pricing, sales records, and inventory logs — is
stored securely in the database.

3
4. Better Customer Experience
Faster checkout, accurate billing, and quicker stock tracking improve overall service at
the point of sale.

1.5 Advantages of the Proposed System

The Shopping Mall Management System (SMMS) offers numerous advantages that
significantly improve operational efficiency, security, and scalability of mall management
processes. The key benefits include:

1. Time-Saving Operations
Automation of tasks like billing, inventory updates, and sales reporting drastically
reduces the time required for daily activities, allowing both shopkeepers and mall
administrators to focus on core business operations.

2. Enhanced Accuracy and Reliability


Since the system minimizes human intervention in calculations and data entry, it ensures
high accuracy in inventory records, sales reports, and billing. Reliable data helps prevent
stock mismatches and financial discrepancies.

3. User-Friendly Interface
Designed with Java Swing GUI, the system offers a graphical user interface that is
intuitive, responsive, and easy to use, even for users with basic computer knowledge.

4. Multi-User Environment
The system supports multiple users with role-based access — ensuring that Admins and
Shopkeepers can perform their respective tasks independently without compromising
data integrity.

5. Real-Time Monitoring and Control


Administrators can view real-time sales reports, stock levels, and shop performance
instantly. This helps in better planning, stock replenishment, and decision-making.

6. Environmentally Friendly
By eliminating paperwork and manual logs, the system contributes to reducing paper
usage, supporting eco-friendly digital transformation.

7. Cost-Effective in the Long Run


While there may be initial development and deployment costs, the system pays off by
reducing the need for extra manpower, minimizing errors, and streamlining operations.

4
8. Better Vendor Coordination
With accurate stock records and timely sales reports, the system enables better
communication and coordination with product vendors, ensuring timely restocking and
variety in product offerings.

Conclusion:
The proposed Shopping Mall Management System not only addresses the limitations of
manual operations but also adds value by enhancing accuracy, efficiency, and service
quality. These advantages make it an ideal solution for modern shopping malls aiming
for smart, data-driven management.

5
CHAPTER 2 – SYSTEM ANALYSIS

2.1 Feasibility Study

Before starting development, a feasibility study was conducted to assess the practicality of
implementing the Shopping Mall Management System (SMMS). The following types of
feasibility were considered:

• Technical Feasibility
The technologies involved—Java (Swing GUI) and MySQL—are well-supported, widely
used, and compatible with all major operating systems. Tools required for development
are open-source or freely available, making it technically viable for both academic and
real-world environments.

• Operational Feasibility
The system is designed with ease of use and clarity in mind. Users such as admins and
shopkeepers can interact with the GUI without technical knowledge. All features are
implemented through forms, buttons, and tables with minimal training required.

• Economic Feasibility
All tools used (Java, MySQL, NetBeans/Eclipse) are open-source or free for student use,
so no additional cost is incurred. Time spent on development is justified by the amount
of automation and time saved post-deployment.

• Schedule Feasibility
The timeline for development was estimated based on modules and deliverables. With
structured planning, the system was completed within the scheduled time frame,
ensuring no delays or overspending.

Conclusion: The project is feasible from all perspectives—technical, operational, economic, and
schedule-wise.

6
2.2 Analysis Methodology
The methodology followed during the analysis of the existing system (manual processes) and
the development of the new system (SMMS) is structured as follows:

Problem Identification
Traditional mall management relies on manual entry of stocks, paper-based bills, and
human-dependent supervision. This leads to delays, miscalculations, missing stock data,
and lack of transparency.

• Requirements Gathering
Data was collected through:

o Observation of existing mall systems o

Interviews with shopkeepers and administrators o

Academic knowledge and project requirements

• Requirement Analysis
Requirements were grouped as:

o Functional (e.g., user login, billing, inventory updates) o

Non-functional (e.g., performance, security, scalability)

• System Specification
Based on analysis, the system must: o Support two types

of users (Admin and Shopkeeper) o Allow billing with

automatic stock deduction o Provide real-time

inventory and sales reports o Secure all data via

authentication and validation

• Data Flow & Navigation


A Data Flow Diagram (DFD) and use-case models were prepared to understand the flow
of data across modules (included in Chapter 3).

Conclusion: A complete system analysis was conducted to design a reliable, user-friendly, and
efficient software system that improves over the manual system.

7
2.3 Choice of Platform: Software and Hardware

The platform selection plays a crucial role in ensuring system performance, ease of
development, and long-term maintainability.

SOFTWARE REQUIREMENTS:
Component Specification

Operating System Windows 10 or above / Linux

Language Java (JDK 8 or above)

IDE NetBeans / Eclipse

Database MySQL 5.7 or above

Libraries Used [Link], [Link]

Connectivity JDBC (Java Database Connectivity)

HA RDWARE REQUIREMENTS:

Component Minimum Requirement

Processor Intel Core i3 or equivalent

RAM 4 GB RAM or more

Hard Disk 1 GB free space

Display 14” monitor or higher

Keyboard/Mouse Standard input devices


Conclusion: The choice of platform ensures that the system is easy to deploy in any mall or
retail environment and can be operated by non-technical staff without difficulty.

8
CHAPTER 3 – SYSTEM DESIGN

System design is the process of defining the architecture, components, modules,


interfaces, and data for a system to satisfy specified requirements. The purpose of design is to
transform the requirements into a blueprint for constructing the software.

The system design for SMMS was created using standard software engineering principles. It
reflects a layered structure separating the user interface, business logic, and database access
components.

3.1 Design Methodology


The project uses the traditional software development life cycle (SDLC), particularly the
Waterfall model, which consists of the following stages:

1. Requirement Analysis

2. System Design

3. Implementation

4. Testing

5. Deployment

6. Maintenance

Each step is executed in a linear sequence and forms the foundation for the next phase.

9
3.2 Data Flow Diagrams (DFDs)

DFDs represent the logical flow of data in the system.

Level 0 – Context Level DFD

• Describes interaction between external users


(Admin and Shopkeeper) and the system.

• Data flows include: o Login credentials o

Product data o Bill details o Inventory reports

Level 1 – Detailed DFD (Major Modules)

• Login Module o Inputs: Username, Password o

Process: Authenticate user o Output: Access to

role-specific dashboard

• Admin Module

o Inputs: Product details, shopkeeper records

o Process: Add/Edit/Delete/View products o

Output: Updated inventory, reports

10
• Shopkeeper Module o Inputs: Product ID,

Quantity o Process: Generate Bill o Output:

Final bill, updated stock

DFD DIAGRAM

11
3.3 Entity Relationship Diagram (ER Diagram)

The ER Diagram shows the database relationships between tables.

Entities:

• User

o user_id (PK) o username o password o role (Admin / Shopkeeper)

• Product o product_id (PK) o product_name o price o quantity

• Bill o bill_id (PK)

o date

o shopkeeper_id (FK)

• Bill_Items o bill_id (FK) o product_id (FK) o quantity o total_price

Relationships:

• One Admin manages many Products

• One Shopkeeper creates many Bills

• One Bill has many Products (via Bill_Items)

• One Product can appear in many Bills

12
3.4 Input Design

Input forms are built with clarity and validation in mind. Each input field is labeled and validated
to avoid incorrect entries.

Examples:

• Login Form: Username, Password, Role (Combo Box)

• Add Product Form: Product Name, Price, Quantity

• Billing Form: Product Selection, Quantity, Add to Bill Button

3.5 Output Design

Outputs are generated in the form of:

• Tabular inventory listings

• Real-time bill generation in text area

13
• Reports in tabular or printable format

Each output includes time/date stamps, formatting, and alignment for professional presentation.

14
CHAPTER 4 – TESTING AND IMPLEMENTATION

Testing and implementation are crucial stages in software development. Testing helps ensure
that the system behaves as expected and is free from defects, while implementation involves
putting the tested system into actual use by end-users.

The SMMS was tested rigorously using various software testing methods. Both Admin and
Shopkeeper modules were verified using a structured testing plan to eliminate functional and
logical errors.

4.1 Types of Testing Used

A combination of white-box and black-box testing techniques were used:

Type of Testing Purpose

Unit Testing To test individual modules like login validation, product insert

Integration Testing To check the flow between modules: Login → Dashboard

System Testing To ensure the entire system works as a whole

Acceptance Testing To validate system behavior from end-user perspective


4.2 Unit Testing

Each function (login, add product, generate bill) was tested individually with expected and
edgecase inputs. Examples:

• Empty username

• Invalid price input

• Bill generation with 0 quantity

JUnit was used for testing back-end methods, and Swing interfaces were manually validated.
Results: All modules passed unit tests with valid and invalid inputs.

4.3 Module Testing

Modules were tested independently and together:

15
• Login + Role Redirection

• Admin Panel + Product Form

• Shopkeeper Panel + Billing

Each module was verified for logical integrity, usability, and error-handling (like SQL exceptions).

Results: All modules interacted correctly and passed control smoothly.

4.4 System Testing

The entire system was run as a whole, testing complete workflows:

• Admin logs in → Adds product → Views inventory → Logs out

• Shopkeeper logs in → Generates multiple bills → Views remaining stock Scenarios

included concurrent access, stock updates, and long product lists.

Result: The complete system behaved as expected under various test cases.

4.5 Alpha and Beta Testing

• Alpha Testing was done by developers on the development machine using test data.

• Beta Testing was conducted by peers who acted as end-users (admin/shopkeeper).


Feedback included: o Add confirmation dialog after product insertion o Improve
button color contrast o Add “Clear” button in billing screen

These suggestions were implemented before final deployment.

Result: Positive feedback and full functionality verified.

4.6 White Box & Black Box Testing

• White Box Testing: Internal code logic for stock update, data insertion, and bill
calculation was verified using conditions, loops, and exception handling.

• Black Box Testing: The system was tested from user perspective without knowing the
code. This involved GUI testing and form submissions.

16
Result: No logical failures or functional mismatches observed.

4.7 Implementation Strategy

The software was implemented in phases:

1. Phase 1 – Setup

o MySQL Database created with tables (users, products, bills, bill_items) o

Java Development Environment configured (NetBeans, JDBC)

2. Phase 2 – Admin Module Implementation o

Login → Add Product → Inventory View

3. Phase 3 – Shopkeeper Module o Login →

Generate Bill → Update stock

4. Phase 4 – Reports & Final Touch o Daily Sales

23Report o GUI polish and font fixes

5. Phase 5 – Deployment o Final JAR compiled o

Packaged with .sql database dump and

manual

Deployment:

The software is intended to run as a standalone desktop application. Installation steps:

• Install Java JDK

• Run MySQL Server and import database

• Launch application using NetBeans or via compiled JAR

17
CHAPTER 5 – CONCLUSION AND REFERENCES

The Shopping Mall Management System (SMMS) has been designed and developed to bring
automation and efficiency to traditional shopping mall operations. It replaces the outdated
manual system with a streamlined, accurate, and secure digital platform. The software was
implemented using Java for the front-end and MySQL for the back-end, and it offers role-based
features for both Admin and Shopkeeper.

5.1 Conclusion

The SMMS project fulfilled its objective of developing a reliable, user-friendly, and scalable
desktop application that can:

• Authenticate users as Admin or Shopkeeper

• Allow Admins to manage inventory and view reports

• Allow Shopkeepers to generate bills and automatically update stock

• Maintain a secure and structured database

• Provide real-time access to stock and billing history

Key strengths of the software include:

• Intuitive Graphical User Interface (GUI) using Java Swing

• Role-based access control for secure operations

• Easy billing with automatic stock deduction

• Simplified product management

• Printable output and summary reports

Through this project, I gained valuable practical experience in system analysis, database
connectivity, object-oriented programming, and user interface design.

18
5.2 Limitations of the Project

Like any prototype or first release, the current version of the Shopping Mall Management
System has a few limitations:

• It is a standalone desktop application and does not support multi-user concurrency over
a network.

• There is no support for barcoding or automated scanners.

• No graphical charts or dashboard visualizations are provided in the current UI.

• Billing reports are generated in plain text; no PDF/export support is included yet.

• No email/SMS integration for sending bills or stock alerts.

5.3 Future Scope

There is ample room for improvement and expansion of the system in future versions.
Suggested enhancements include:

Web-Based Version
Convert the system into a cloud/web application using technologies like Spring Boot
(Java) or Django (Python) with frontend frameworks like ReactJS.

1. Mobile Application
Develop Android and iOS versions to allow shopkeepers to manage bills via smartphones
or tablets.

2. Dashboard and Analytics


Integrate visual charts for daily/weekly sales, top-selling products, and low stock alerts.

3. Vendor & Purchase Management


Allow admins to log purchases from suppliers and track vendor payments.

4. Printable Reports & PDF Export


Generate invoice, inventory, and sales reports in PDF format with branding and digital
signature.

5. GST/Billing Compliance
Add support for GST tax structure, invoice formatting, and secure recordkeeping.

AI-Based Suggestions
Use sales history to suggest re-stocking or promotional offers.

19

5.4 Hardware and Software Requirements

SOFTWARE:
Software Description

OS Windows 10 / Linux

Language Java JDK 8+

Database MySQL 5.7 or higher

IDE NetBeans / Eclipse

GUI Library Java Swing

HARDWARE:
Hardware Minimum Requirement

Processor Intel i3 or higher

RAM 4 GB

HDD 500 MB minimum

Display 1024×768 resolution


5.5 References

• Java Documentation – [Link]

• MySQL Reference Manual – [Link]

• Stack Overflow – For troubleshooting runtime errors

• GitHub & Open Source Repositories – Code style and design references

• TutorialsPoint & GeeksForGeeks – Java Swing and JDBC tutorials

CHAPTER 6 – ANNEXURES

20
6.1 Menu Flow Diagram

6.2 Input Forms :


• Login Form (Username, Password, Role)

• Admin Dashboard

• Product Entry Form

• Inventory Table View

• Shopkeeper Billing Screen

• Generated Bill in Text Area

6.3 Output Screens (Sample Data)


Output formats include:

Inventory Output
(Sample Table Displayed in JTable)

21
ID Name Price Quantity
(₹)
11 Apple Juice 40 150

22 Oreo Pack 25 100

 Sample Bill (Displayed in TextArea)

Example:

BILL
Date: 28-May-2025
Items:
Oreo Pack – ₹25 x 2 = ₹50
Total: ₹50
Thank You!

6.4 Database Schema (Tables and


Fields) users table

Field Type Description

id INT (PK) Auto-increment ID

username VARCHAR(50) Login username

password VARCHAR(50) Login password

role ENUM Admin / Shopkeeper

products table

Field Type Description

id INT (PK) Auto-increment product ID

name VARCHAR(100) Product name

price DOUBLE Price per item

22
quantity INT Current stock level
bills table

Field Type Description

id INT Bill ID
(PK)
date DATE Date of purchase

shop_id INT (FK) Shopkeeper user ID

bill_items table

Field Type Description

bill_id INT (FK) Reference to bills

product_id INT (FK) Product sold

qty INT Quantity sold

total DOUBLE Total price

23
6.5 Screen Design (GUI Forms)

24
25
26
1. Database Setup (MySQL)

CREATE DATABASE shopping_mall;

USE shopping_mall;

CREATE TABLE users ( id INT

AUTO_INCREMENT PRIMARY KEY,

username VARCHAR(50), password

VARCHAR(50), role ENUM('Admin',

'Shopkeeper')

);

27
CREATE TABLE products ( id INT

AUTO_INCREMENT PRIMARY KEY, name

VARCHAR(100), price DOUBLE, quantity

INT

);

CREATE TABLE bills ( id INT

AUTO_INCREMENT PRIMARY KEY, date

DATE, shop_id INT

);

CREATE TABLE bill_items (

bill_id INT,

product_id

INT, qty INT,

total DOUBLE

);

2. Java Database Connection File

import [Link].*;

public class DBConnection { public static

Connection getConnection() { try {

[Link]("[Link]");

return [Link](

28
"jdbc:mysql://localhost:3306/shopping_mall", "root", "your_password"

);

} catch (Exception e)

{ [Link]();

return null;

3. Login Form (Admin or Shopkeeper)

import [Link].*;

import [Link].*;

import [Link].*;

public class LoginForm extends JFrame {

JTextField userField = new JTextField();

JPasswordField passField = new JPasswordField();

JComboBox<String> roleBox = new JComboBox<>(new String[]{"Admin", "Shopkeeper"});

JButton loginBtn = new JButton("Login");

public LoginForm()

{ setTitle("Login");

29
setSize(300, 200);

setLayout(null);

add(new JLabel("Username")).setBounds(30, 20, 80, 25);

add(userField).setBounds(120, 20, 130, 25); add(new

JLabel("Password")).setBounds(30, 50, 80, 25);

add(passField).setBounds(120, 50, 130, 25); add(new

JLabel("Role")).setBounds(30, 80, 80, 25);

add(roleBox).setBounds(120, 80, 130, 25);

add(loginBtn).setBounds(100, 120, 100, 30);

[Link](e -> login());

setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible(true);

void login() {

String user = [Link]();

String pass = new String([Link]()); String

role = (String) [Link]();

try (Connection conn = [Link]()) {

PreparedStatement ps = [Link](

"SELECT * FROM users WHERE username=? AND password=? AND role=?"

);

30
[Link](1, user);

[Link](2, pass);

[Link](3, role);

ResultSet rs = [Link](); if ([Link]())

{ dispose(); if ([Link]("Admin")) new

AdminPanel(); else new ShopkeeperPanel();

} else {

[Link](this, "Login failed.");

} catch (Exception ex) { [Link]();

public static void main(String[] args)

{ new LoginForm();

31
4. Admin Panel (Add Products)

import [Link].*;

import [Link].*;

import [Link].*;

public class AdminPanel extends JFrame {

JTextField nameField = new JTextField();

JTextField priceField = new JTextField();

JTextField qtyField = new JTextField();

JButton addBtn = new JButton("Add Product");

public AdminPanel()

{ setTitle("Admin Panel");

setSize(300, 250);

setLayout(null);

add(new JLabel("Product Name")).setBounds(20, 20, 100, 25);

add(nameField).setBounds(130, 20, 130, 25); add(new

JLabel("Price")).setBounds(20, 60, 100, 25);

add(priceField).setBounds(130, 60, 130, 25); add(new

JLabel("Quantity")).setBounds(20, 100, 100, 25);

add(qtyField).setBounds(130, 100, 130, 25);

add(addBtn).setBounds(80, 150, 120, 30);

32
[Link](e -> addProduct());

setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible(true);

void addProduct() { try (Connection conn =

[Link]()) {

PreparedStatement ps = [Link](

"INSERT INTO products (name, price, quantity) VALUES (?, ?, ?)"

);

[Link](1, [Link]()); [Link](2,

[Link]([Link]())); [Link](3,

[Link]([Link]())); [Link]();

[Link](this, "Product Added!");

} catch (Exception ex) { [Link]();

5. Shopkeeper Panel (Billing)

import [Link].*;

import [Link].*;

import [Link].*;

33
public class ShopkeeperPanel extends JFrame {

JTextField productIdField = new JTextField();

JTextField qtyField = new JTextField(); JButton

billBtn = new JButton("Generate Bill");

public ShopkeeperPanel()

{ setTitle("Shopkeeper Panel");

setSize(300, 200); setLayout(null);

add(new JLabel("Product ID")).setBounds(20, 30, 100, 25);

add(productIdField).setBounds(130, 30, 120, 25); add(new

JLabel("Quantity")).setBounds(20, 70, 100, 25);

add(qtyField).setBounds(130, 70, 120, 25);

add(billBtn).setBounds(80, 120, 120, 30);

[Link](e -> generateBill());

setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible(true);

void generateBill() { int pid =

[Link]([Link]()); int qty

= [Link]([Link]());

try (Connection conn = [Link]()) {

34
// Update stock

PreparedStatement ps = [Link](

"UPDATE products SET quantity = quantity - ? WHERE id = ?"

);

[Link](1, qty); [Link](2, pid);

int updated =

[Link](); if (updated >

0) {

[Link](this, "Bill Generated & Stock Updated!");

} else {

[Link](this, "Error! Invalid Product or Stock.");

} catch (Exception ex) { [Link]();

35

You might also like