PET SHOP MANAGEMENT
[Link] GOPAL (23322001)
[Link] (23322008)
ADVANCED JAVA PROGRAMMING-LAB
DEPARTMENT OF COMPUTER SCIENCE AND
APPLICATIONS.
COURSE TEACHER : [Link],MCA.,Ph.D.,
GANDHIGRAM RURAL
INSTITUTE. GANDHIGRAM-
624 302.
INDEX
[Link] CONTENTS PAGE NO
1. INTRODUCTION 1
2. SOFTWARE DESCRIPTION 2
3. SYSTEM DESIGN
6
3.1 FLOW DIAGRAM
3.2 TABLE DESIGN 7
3.3 MODULE DESCRIPTION 8
4. CODING 10
5. SCREENSHOT 15
1. INTRODUCTION :
The Pet Shop Management System is designed to streamline the operations of a pet
shop, facilitating efficient management of pet inventory, sales .The system is developed using
Java JDBC (Java Database Connectivity) for database connectivity and MS Access for
database management.
This system allows the user to log in and in home page various pets categories are
getting listed such as dog, cat, birds , fish etc., After selecting the category there are various
breeds are available for show .After that, quantity must be chosen for the preferred pets .
After the selection of pets which you want to buy, it gets add to the cart then the bill will be
generated for your purchase after receiving the customer details .
1
2. SOFTWARE DESCRIPTION :
FRONT-END : Java , Swing.
BACK-END : Microsoft Access.
CONNECTIVITY : JDBC (Java Database Connectivity).
JAVA PROGRAMMING LANGUAGE :
Java, introduced by Sun Microsystems in 1995, stands as a testament to the evolution
of programming languages, offering a unique blend of simplicity, power, and versatility.
Developed by James Gosling and his team, Java was initially aimed at interactive television
but quickly found its niche as a language that could transcend platform boundaries. Its core
philosophy, encapsulated in the slogan "write once, run anywhere" (WORA), allows Java
programs to be executed on any device equipped with a Java Virtual Machine (JVM), making
it an indispensable tool for cross-platform development.
Java's architecture is designed around the concept of object-oriented programming
(OOP), which promotes modular, reusable, and maintainable code. The language supports
key OOP principles such as inheritance, encapsulation, polymorphism, and abstraction, which
help developers create complex applications with a clear and manageable structure. Java's
syntax, borrowing elements from C and C++, is both familiar and straightforward, facilitating
a gentle learning curve for beginners while offering advanced features for seasoned
developers.
2
JAVA SWING :
Java Swing, part of the Java Foundation Classes (JFC), is a powerful toolkit for building graphical user
interfaces (GUIs) in Java applications. Introduced by Sun Microsystems in 1997 as part of Java 1.2, Swing
offers a rich set of components and functionalities that enable developers to create sophisticated, platform-
independent interfaces. Unlike its predecessor, the Abstract Window Toolkit (AWT), Swing is entirely written
in Java, providing a more flexible and customizable environment for GUI development.
One of the standout features of Swing is its "lightweight" component architecture. This means that
Swing components are not reliant on the underlying platform's native GUI controls, allowing for a consistent
look and feel across different operating systems. This cross-platform capability is a significant advantage,
ensuring that applications behave similarly regardless of where they are run. Swing achieves this through its
pluggable look and feel (PLAF) architecture, which allows developers to specify the appearance of their
applications either through predefined themes like Metal, Nimbus, or by creating custom ones.
Swing includes a comprehensive set of GUI components, such as buttons, labels, text fields, tables,
trees, and more. These components are designed to be highly customizable. For example, developers can alter
the behavior and appearance of components by extending existing classes and overriding their methods. The
Model-View-Controller (MVC) architecture that Swing employs further enhances this flexibility. By
separating the data (Model), the visual representation (View), and the logic that handles the interaction
(Controller), Swing components allow for more manageable and scalable code.
3
JDBC DRIVER :
Java Database Connectivity (JDBC) is a pivotal API introduced by Sun Microsystems
that revolutionized how Java applications interact with databases. Since its debut in 1997 as
part of JDK 1.1, JDBC has provided developers with a standardized method for connecting to
and executing operations on a variety of database management systems (DBMS). The core
strength of JDBC lies in its ability to enable database-agnostic development. By adhering to
the JDBC API, developers can write Java code that interacts with different databases without
needing to tailor their code to specific DBMS features.
JDBC's architecture comprises several key components: the Driver Manager, which
loads database drivers dynamically and establishes connections; the Connection interface,
representing a session with a specific database; the Statement, PreparedStatement, and
CallableStatement interfaces, which are used to execute SQL queries and updates; and the
ResultSet interface, which holds data retrieved from the database and allows traversal of the
query results.
A primary advantage of JDBC is its support for a wide range of SQL operations,
including data querying, updating, and schema manipulation. JDBC also facilitates
transaction management, allowing developers to commit or roll back a series of operations,
thus ensuring data integrity. Advanced features such as batch updates enhance performance
by reducing the number of database round-trips, while connection pooling improves resource
management and scalability by reusing database connections.
4
MICROSOFT ACCESS:
Microsoft Access, commonly referred to as MS Access, is a powerful and versatile
database management system (DBMS) that has been a staple in the Microsoft Office Suite
since its introduction in 1992. Designed to cater to both novice users and experienced
developers, MS Access combines a user-friendly interface with robust features that facilitate
the creation, management, and analysis of relational databases.
At its core, MS Access provides a platform for organizing and storing data in a
structured format, utilizing tables that can be linked through relationships. This relational
database model allows users to efficiently manage large amounts of data and maintain data
integrity through the enforcement of rules and constraints. Users can easily define and modify
the database schema using intuitive graphical tools, which simplifies database design and
reduces the learning curve. One of the standout features of MS Access is its powerful query
engine, which enables users to retrieve and manipulate data using Structured Query Language
(SQL). The graphical query designer allows users to build complex queries without needing
extensive SQL knowledge, while advanced users can write and execute custom SQL
commands directly. Queries in MS Access can perform a wide range of operations, from
basic data retrieval and filtering to complex calculations and data aggregation.
MS Access also excels in its ability to create user-friendly forms and reports. Forms
serve as customizable interfaces for data entry and navigation, providing a seamless way to
interact with the database. With drag-and-drop controls and extensive formatting options,
users can design forms that are both functional and visually appealing. Reports, on the other
hand, allow users to format and present data in a printable layout, making it easy to generate
professional-looking documents and summaries.
5
[Link] DESIGN:
3.1 FLOW DIAGRAM :
6
3.2 TABLE DESIGN :
Table Name : USER
Fieldname Data type
first Long Text
last Long Text
mobile Number
email Long Text
password Long Text
cpassword Long Text
address Long Text
Table Name : PRODUCT
Fieldname Data type
proname Long Text
proprice Number
7
3.3 MODULE DESCRIPTION :
User Authentication
Add to Cart
Payment
USER AUTHENTICATION :
In this application, a user authentication module is essential for managing user access,
securing sensitive data, and providing a personalized shopping experience. This module typically
includes features for user registration (signup) and login. If the user is new to this application we
remind them to register themselves. After their registration they can login with their mobile number
as their username and the password that provided by them during registration .
ADD TO CART :
The "Add to Cart" module in this application is a crucial feature that enhances the
user shopping experience by allowing users to select and manage products they intend to purchase.
It is designed to maintain a seamless flow from product selection to checkout. The module uses
repositories to manage database interactions and services to handle business logic, ensuring that
each user can have a personalized cart. By leveraging technologies like JDBC and a relational
database, the "Add to Cart" module efficiently manages cart operations and persists user selections,
providing a robust and user-friendly interface for the shopping process.
PAYMENT :
The payment module in this application is a critical component that facilitates secure
and seamless transactions, offering customers a variety of payment methods to complete their
purchases. This module typically supports multiple payment options, including credit and debit
cards, digital wallets (such as PayPal and Apple Pay), bank transfers, and sometimes newer
methods like cryptocurrency. The payment module is essential for the financial operations of an
eCommerce platform, ensuring transactions are processed smoothly and securely.
8
4. CODING :
[Link]
import [Link].*;
import [Link].*;
class log {
JFrame f; JLabel l1,l2,l3,l4; JTextField tf1; JButton b1,b2;JPasswordField p1;
PreparedStatement pstm;
ResultSet reset; String sq; JLabel bg;
log(){
f=new JFrame("LOGIN");
[Link](null);
[Link](500,500);
[Link](JFrame.EXIT_ON_CLOSE);
[Link](null);
l1=new JLabel("NanMad PETZONE");
l2=new JLabel("MOBILE");
l3=new JLabel("PASSWORD");
l4=new JLabel("If You Didn't REGISTER , Please SIGN-UP");
tf1=new JTextField();
p1=new JPasswordField();
[Link]('*');
b1=new JButton("LOGIN");
b2=new JButton("SIGN-UP");
[Link](160,40,200,30); [Link](200,240,100,35);
[Link](50,130,200,30); [Link](180,130,200,30);
[Link](50,170,200,30); [Link](180,170,200,30);
[Link](40,364,470,20); [Link](280,363,100,20);
[Link](l1);[Link](l2);[Link](l3);[Link](l4);
[Link](tf1); [Link](p1);
[Link](b1);[Link](b2);
[Link](true);
9
[Link](new ActionListener()
{
public void actionPerformed(ActionEvent ae)
{
String mobile=[Link]();
String pass=[Link]();
try
{
[Link]("[Link]");
Connectionconn
=[Link]("jdbc:ucanaccess://D://PetShop//[Link]");
Statement stmt = [Link]();
String query = "SELECT * FROM user WHERE mobile = '" + mobile + "' AND
password = '" + pass + "'";
ResultSet rs = [Link](query);
if ([Link]())
{
home1 h = new home1();
[Link]();
}
else
{
[Link](null,"Invlaid user please SIGN-UP");
}
[Link]();
[Link]();
[Link]();
}
class login{
public static void main(String args[])
{ log l = new log();
}
}
10
[Link]
import [Link].*;
class home1 {
JFrame f;
JButton dog,cat,fish,birds;
ImageIcon idoggy,icat,ifish,ibirds;
JLabel l1 ;
home1(){
f= new JFrame("CATEGORIES");
idoggy = new ImageIcon("[Link]");
Image im1 = [Link]().getScaledInstance(150, 150,
Image.SCALE_REPLICATE);
ImageIcon idoggy1 = new ImageIcon(im1);
JLabel idoggy2= new JLabel(idoggy1);
icat = new ImageIcon("[Link]");
Image im2 = [Link]().getScaledInstance(150, 150, Image.SCALE_REPLICATE);
ImageIcon icat1 = new ImageIcon(im2);
JLabel icat2= new JLabel(icat1);
ibirds = new ImageIcon("[Link]");
Image im3 = [Link]().getScaledInstance(150, 150,
Image.SCALE_REPLICATE);
ImageIcon ibirds1 = new ImageIcon(im3);
JLabel ibird2= new JLabel(ibirds1);
ifish = new ImageIcon("[Link]");
Image im4 = [Link]().getScaledInstance(150, 150,
Image.SCALE_REPLICATE);
ImageIcon ifish1 = new ImageIcon(im4);
JLabel ifish2 = new JLabel(ifish1);
l1= new JLabel("CHOOSE YOUR PET");
dog=new JButton("Dog"); cat=new JButton("Cat"); fish=new JButton("Fish");
birds=new JButton("Birds");
[Link](null);
[Link](500,500);
11
[Link](175,10,200,20);
[Link](new ActionListener()
{ public void actionPerformed(ActionEvent
ae2){
doggy d = new doggy();
[Link]();
}
});
[Link](new ActionListener()
{ public void actionPerformed(ActionEvent
ae2){
catty x = new catty();
[Link]();
}
});
[Link](new ActionListener()
{ public void actionPerformed(ActionEvent
ae2){
fishy g = new fishy();
[Link]();
}
});
[Link](new ActionListener()
{ public void actionPerformed(ActionEvent
ae2){
birdy o = new birdy();
[Link]();
}});
[Link](null);
[Link](true);}
class home{
// public static void main(String args[])
// {
12
// home1 h = new home1();
// }
}
13
[Link]
import [Link].*;
class check{
JFrame f;
JLabel l1;
JRadioButton rb1, rb2, rb3, rb4, rb5;
ButtonGroup bg;
JButton b1;
check(){
f=new JFrame("Checkout");
[Link](500,500);
[Link](null);
[Link](JFrame.EXIT_ON_CLOSE);
[Link]().setBackground(new Color(183,249,242));
l1=new JLabel("CHOOSE YOUR PAYMENT METHOD");
[Link](new Font("SERIF", [Link], 24));
b1=new JButton("CONFIRM");
bg = new ButtonGroup();
rb1 = new JRadioButton("Credit Card");
rb2 = new JRadioButton("Debit Card");
rb3 = new JRadioButton("QR Code");
rb4 = new JRadioButton("UPI");
rb5 = new JRadioButton("Net Banking");
[Link](rb1);
[Link](rb2);
[Link](rb3); [Link](rb4); [Link](rb5);
[Link](120,300,100,30);
[Link](rb1);
[Link](rb2);
14
[Link](rb3); [Link](rb4); [Link](rb5);
[Link](l1);[Link](b1);
[Link](25,70,500,30);
[Link](true);
[Link](new ActionListener()
{ public void actionPerformed(ActionEvent ae)
{
if([Link]() || [Link]() ||[Link]() || [Link]() ||
[Link]()){
[Link](null,"PAYMENT SUCCESSFUL ! THANK
YOU VISIT AGAIN");
[Link]();}
else{
[Link](null,"PLEASE SELECT THE PAYMENT
METHOD");
}
}});}
}
class checkout{
public static void main(String args[])
{ check c = new check();
}
}
15
5. SCREENSHOTS :
16
17
18
19
20