Professional Documents
Culture Documents
Karachi Campus
Course: CSL-210
Object Oriented Programming Lab
Term: Spring 2020, Class: BSE- 2(B)
Project Report
Project Title:
GYM MANAGEMENT SYSTEM____
Submitted To:
GYM MANAGEMENT
SYSTEM
BY
Usman Najeeb, Mustansar Gul, Muhammad Haris sarwar,
Hasnain Khalid
Page 4 of 50
[Project Report] [OOP Lab]
Table of Content
Abstract ………………………………………………………. 06
Introduction ………………………………………………….. 07
Background ………………………………………………….. 07
Deccription …………………………………………….......... 07
Code ………………………………...……………………… 10
Login Table…………….………………………….... 45
Equipment table….……………….………….……... 45
Trianer Table….………………………….……….... 45
Output …………………………………………………....... 46
Conclusion …………………………………………………. 49
Abstract:
Page 5 of 50
[Project Report] [OOP Lab]
A system for managing a Gym. This system keeps track of employee salaries, inventory and
customer data along with billing. This is a fully equipped system that alone manages the entire functioning of a
hair salon. It maintains stock of inventory coming in. It also manages individual employee salary. The system is
even equipped to manage customer billing and data storage.
Project Overview:
Here’s a look at the benefits of a computerized gym management system:
Appointments:
There’s no need to flip between pages, erasing and re-writing appointments or trying to decipher your
colleague’s handwriting.
Appointments systems are incredibly simple to use and you’ll have everything you need on one page to
keep your appointments organized and running smoothly. You can color code for even easier use and you
can add notes to specific appointments without running out of space.
Client’s Records:
Handwritten client notes can be mislaid and make it easier for you to make mistakes. Computerized records
give you a detailed profile package for every client from past and present treatments to allergies and even how
they take their coffee.
Introduction:
Page 6 of 49
[Project Report] [OOP Lab]
The gym management system focused on customer services that how it will be easy for the customer to just take
an appointment and then come so he do not worry about the time he just need to come and take the service this
is totally a digital method so you do not need to worry about the prices the prices are fix and we do not
overcharge you every employee have its id and also specialist in it work if he do work bad we also have an
option to delete the employee in our saloon the stocks are very good because the stock expiry date and no of
uses are all write comprised. We can add services update the services and many more things can done in this
Saloon Management System.
Background:
Being aware of the manual processes First it is very time consuming and this is also very bad for customer
relationship in previous we need to write in manually about the customer and employee but if the this will stole
then all the data leak. In some saloon the staff charge the customer very high because this is previous but we are
living in the latest century so the computerized thing is best for this. The Customer time also save by taking an
appointment some time when the customer come and need a service but saloon do not have products, stock but
in this system we do not worry about this all are done computerized so admin can easily check the stock and
add the stock.
Description:
The gym Management System aims at the Customer Services carried out in the Saloon by giving services to
Customer. There are two types of Services Appointment Services and Customer Intake.
In Appoint Services we can add Customer Name, Age, Contact no, Billing ID, especially Date and Time, also
have an option of in studio or not And the no of Services that customer want.
The other service is we can provide is Costumer intake Service. In Customer in take we can add customer
details like their Name, Age, Billing ID, Contact No and the no services they want like some customer want two
or more services.
These all work is done by Staff but admin can also access and preview the customer details.
In Admin aspect we need to login first we can add admin and also delete the previous admin. We can enter the
employee if the new staff comes in saloon that can be added by admin. Stock Update and Delete.
Page 7 of 49
[Project Report] [OOP Lab]
Employee Details Is very must when a new Employee come Admin can add Employee ID, Contact, First Name,
Last Name, Contact, Address, Salary And Their Gender Male/Female This will be save in our Database.
Admin can also delete the employee in this we need to add Employee ID, Contact, First Name, Last Name, and
Contact, Address and Salary and then simple press the delete button.
Admin Can also preview the staff detail in this admin simply need to add Customer name and their details
come.
If we need to change the Customer Address, Customer Contact or Salary Admin can also update the customer
details.
We can add new stock in stock table by entering Product ID, Product Name, ShelfLife, Manufacturer, Max
Uses, Quantity, Services Used In and Their Expiry Date.
Admin can delete the Stock too we need to add Product ID, Product Name, ShelfLife, Manufacturer, Max Uses,
Quantity, Services Used In and Their Expiry Date and then press the Delete Button.
Admin can also update the stock by entering The Product ID, Product Name, Quantity and Their Expiry Date.
Then press the update button.
Admin can also add the Services, Search the Services and Update the services.
In adding a new services panel admin just need to add Service ID , Service Name And their Services Charges
then Press the add button.
Admin Can also Search the services by entering service ID and then all the information about this service come.
Admin can update the service by entering service ID and Prep Charges.
Admin Aspects:
1) Add Admin
Add a new Admin.
2) Delete Admin
Delete the previous Admin.
3) Modify Stock
Addition, Deletion and also update the Stock.
4) Preview Customer
View the Customer Details.
1) Making Appointments
Can make Appointments for Customers.
Code:
Page 9 of 49
[Project Report] [OOP Lab]
GYM
Signup:
package Gym;
import Gym_classes.Connection2DB;
public Signup() {
initComponents();
@SuppressWarnings("unchecked")
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel1.setLayout(null);
jLabel2.setText("Enter Username");
jPanel1.add(jLabel2);
Page 10 of 49
[Project Report] [OOP Lab]
jButton1.setText("SignUp");
jButton1.addActionListener(new java.awt.event.ActionListener() {
jButton1ActionPerformed(evt);
});
jPanel1.add(jButton1);
jLabel3.setText("Enter Password");
jPanel1.add(jLabel3);
jLabel5.setText("ADMIN SIGNUP");
jPanel1.add(jLabel5);
id_txt.addActionListener(new java.awt.event.ActionListener() {
id_txtActionPerformed(evt);
});
jPanel1.add(id_txt);
jPanel1.add(pass_txt);
jButton2.setText("Back to Login");
jButton2.addActionListener(new java.awt.event.ActionListener() {
Page 11 of 49
[Project Report] [OOP Lab]
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
});
jPanel1.add(jButton2);
jPanel1.add(jLabel1);
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
);
pack();
}// </editor-fold>
con.Signup(id_txt.getText(),pass_txt.getText());
Page 12 of 49
[Project Report] [OOP Lab]
}
log.setVisible(true);
/**
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
*/
try {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
Page 13 of 49
[Project Report] [OOP Lab]
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
new Signup().setVisible(true);
});
Logins:
package Gym;
Page 14 of 49
[Project Report] [OOP Lab]
import Gym_classes.Connection2DB;
/**
*/
public Logins() {
initComponents();
setExtendedState(MAXIMIZED_BOTH);
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
*/
@SuppressWarnings("unchecked")
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
Page 15 of 49
[Project Report] [OOP Lab]
getContentPane().setLayout(null);
Login_btn.setText("LogIn");
Login_btn.addActionListener(new java.awt.event.ActionListener() {
Login_btnActionPerformed(evt);
});
getContentPane().add(Login_btn);
getContentPane().add(User_txt);
UserName_lbl.setText("User name");
getContentPane().add(UserName_lbl);
Pass_lbl.setText("Password");
getContentPane().add(Pass_lbl);
getContentPane().add(Pass_txt);
Page 16 of 49
[Project Report] [OOP Lab]
jLabel1.setText("GYM Log In");
getContentPane().add(jLabel1);
jButton1.setText("SignUp");
jButton1.addActionListener(new java.awt.event.ActionListener() {
jButton1ActionPerformed(evt);
});
getContentPane().add(jButton1);
getContentPane().add(jLabel2);
pack();
}// </editor-fold>
String mypass=String.valueOf(Pass_txt.getPassword());
if (con.matchPassword(User_txt.getText(), mypass)) {
home.setVisible(true);
} else {
System.out.println("not matched");
Page 17 of 49
[Project Report] [OOP Lab]
}
sign.setVisible(true);
/**
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
*/
try {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
Page 18 of 49
[Project Report] [OOP Lab]
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
new Logins().setVisible(true);
});
Homepage:
package Gym;
Page 19 of 49
[Project Report] [OOP Lab]
/**
*/
public HomePage() {
initComponents();
setExtendedState(MAXIMIZED_BOTH);
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
*/
@SuppressWarnings("unchecked")
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
getContentPane().setLayout(null);
Page 20 of 49
[Project Report] [OOP Lab]
Customer_btn.setText("CUSTOMER");
Customer_btn.addActionListener(new java.awt.event.ActionListener() {
Customer_btnActionPerformed(evt);
});
getContentPane().add(Customer_btn);
trainer_btn.setText(" TRAINER");
trainer_btn.addActionListener(new java.awt.event.ActionListener() {
trainer_btnActionPerformed(evt);
});
getContentPane().add(trainer_btn);
qequip_btn.setText("EQUIPMENT");
qequip_btn.addActionListener(new java.awt.event.ActionListener() {
qequip_btnActionPerformed(evt);
});
getContentPane().add(qequip_btn);
Page 21 of 49
[Project Report] [OOP Lab]
jLabel2.setForeground(new java.awt.Color(255, 255, 255));
getContentPane().add(jLabel2);
jButton1.setText("BACK");
jButton1.addActionListener(new java.awt.event.ActionListener() {
jButton1ActionPerformed(evt);
});
getContentPane().add(jButton1);
getContentPane().add(jLabel1);
pack();
}// </editor-fold>
e.setVisible(true);
c.setVisible(true);
Page 22 of 49
[Project Report] [OOP Lab]
Trainer t=new Trainer();
t.setVisible(true);
l.setVisible(true);
/**
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
*/
try {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
Page 23 of 49
[Project Report] [OOP Lab]
} catch (IllegalAccessException ex) {
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
new HomePage().setVisible(true);
});
GYM CLASSES
Connection2DB:
Page 24 of 49
[Project Report] [OOP Lab]
package Gym_classes;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.JOptionPane;
//Settingup Connection
String dataSourceName="database/Database2.accdb";
Connection con=null;
try {
con = DriverManager.getConnection(url);
catch(Exception sqlEx){
System.out.println(sqlEx);
return con;
Page 25 of 49
[Project Report] [OOP Lab]
try {
Connection con=setConnection();
Statement st = con.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
successful = true;
else
successful = false;
con.close();
catch(Exception sqlEx){
System.out.println(sqlEx);
return successful;
// SIGNUP
try {
Connection con=setConnection();
pst = con.prepareStatement(sql);
Page 26 of 49
[Project Report] [OOP Lab]
pst.setString(1,username);
pst.setString(2, pass);
pst.execute();
JOptionPane.showMessageDialog(null, "saved");
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
Customer-c:
package Gym_classes;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import net.proteanit.sql.DbUtils;
//Fields Declaration
Page 27 of 49
[Project Report] [OOP Lab]
//Constructor to initialize fields
public Customer_c(String fees, String trainer, String name, String NIC, String Age, String Address, String Gender,
String mobile_num, String time,String jdate,String expdate) {
this.fees = fees;
this.trainer = trainer;
this.MemberShip = jdate;
this.MemberShipExp = expdate;
public Customer_c() {
return fees;
return trainer;
return MemberShip;
return MemberShipExp;
// ADD METHOD
try {
Page 28 of 49
[Project Report] [OOP Lab]
String sql = "Insert into
CustomerTable(Name,NIC,Age,Address,Gender,MobileNo,Fees,Trainer,Timing,MemberShip_Date,MemberShip_Exp)
values (?,?,?,?,?,?,?,?,?,?,?)";
pst = con.prepareStatement(sql);
pst.setString(1, getName());
pst.setString(2, getNIC());
pst.setString(3, getAge());
pst.setString(4, getAddress());
pst.setString(5, getGender());
pst.setString(6, getMobile_num());
pst.setString(7, getFees());
pst.setString(8, getTrainer());
pst.setString(9, getTime());
pst.setString(10,getMemberShip());
pst.setString(11, getMemberShipExp());
pst.execute();
JOptionPane.showMessageDialog(null, "saved");
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
//DELETE METHOD
try {
pst.setString(1, id);
Page 29 of 49
[Project Report] [OOP Lab]
pst.execute();
JOptionPane.showMessageDialog(null, "DLETED");
del = true;
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
return del;
// SEARCH METHOD
ResultSet rs = null;
try {
pst = con.prepareStatement(sql);
pst.setString(1, search);
rs = pst.executeQuery();
table.setModel(DbUtils.resultSetToTableModel(rs));// nahi pata mere khayal may table ko values show kra rha hai
found = true;
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
return found;
//UPDATE METHOD
public boolean update(String id, String name, String nic, String age, String address, String gender, String mobno, String
fees, String timing, String trainer) {
Page 30 of 49
[Project Report] [OOP Lab]
boolean update = false;
try {
String sql = "update CustomerTable set Name='" + name + "',NIC='" + nic + "',Age='" + age + "',Address='" +
address + "',Gender='" + gender + "',MobileNo='" + mobno + "',Fees='" + fees + "',Timing='" + timing + "',Trainer='" +
trainer + "' where id='" + id + "'";
pst.execute();
update = true;
JOptionPane.showMessageDialog(null, "Updated");
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
return update;
//SHOW METHOD
try {
ResultSet rs = pst.executeQuery();
table.setModel(DbUtils.resultSetToTableModel(rs));
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
String name=null;
Page 31 of 49
[Project Report] [OOP Lab]
try {
PreparedStatement pst=con.prepareStatement(sql);
ResultSet rs=pst.executeQuery();
while(rs.next()){
name=rs.getString("Name");
} catch (Exception e) {
JOptionPane.showMessageDialog(null,e);
return name;
Equipment-c:
package Gym_classes;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import net.proteanit.sql.DbUtils;
Page 32 of 49
[Project Report] [OOP Lab]
private String name;
public Equipment_c() {
public Equipment_c( String name, String Quantity, String perprice, String totalprice, String date) {
this.name = name;
this.Quantity = Quantity;
this.perprice = perprice;
this.totalprice = totalprice;
this.date = date;
return ID;
return name;
return Quantity;
return perprice;
Page 33 of 49
[Project Report] [OOP Lab]
return totalprice;
return date;
//ADD METHOD
try {
pst = con.prepareStatement(sql);
pst.setString(1, getName());
pst.setString(2, getQuantity());
pst.setString(3, getPerprice());
pst.setString(4, getTotalprice());
pst.setString(5, getDate());
pst.execute();
JOptionPane.showMessageDialog(null, "saved");
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
//DELETE METHOD
Page 34 of 49
[Project Report] [OOP Lab]
PreparedStatement pst = null;
try {
pst = con.prepareStatement(sql);
pst.setString(1, id);
pst.execute();
JOptionPane.showMessageDialog(null, "DLETED");
del = true;
} catch (Exception e) {
return del;
// SEARCH METHOD
ResultSet rs = null;
try {
pst = con.prepareStatement(sql);
pst.setString(1, search);
rs = pst.executeQuery();
table.setModel(DbUtils.resultSetToTableModel(rs));// nahi pata mere khayal may table ko values show kra rha hai
found = true;
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
Page 35 of 49
[Project Report] [OOP Lab]
}
return found;
//UPDATE METHOD
public boolean update(String id, String name, String quantity, String PriceperQuantity, String totalPrice, String date) {
try {
String sql = "update EquipmentTable set Name='" + name + "',Quantity='" + quantity + "',PricePerQuantity='" +
PriceperQuantity + "',TotalPrice='" + totalPrice + "',Date='" + date + "' where id='" + id + "'";
pst.execute();
update = true;
JOptionPane.showMessageDialog(null, "Updated");
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
return update;
//SHOWDETAILS METHOD
try {
ResultSet rs = pst.executeQuery();
table.setModel(DbUtils.resultSetToTableModel(rs));
} catch (Exception e) {
Page 36 of 49
[Project Report] [OOP Lab]
JOptionPane.showMessageDialog(null, e);
//Calculation method
return Result;
Trainer-c:
package Gym_classes;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import net.proteanit.sql.DbUtils;
public Trainer_c() {
Page 37 of 49
[Project Report] [OOP Lab]
public Trainer_c( String name, String NIC, String Age, String Address, String Gender, String mobile_num, String
Salary, String time) {
this.Salary = Salary;
return Salary;
// ADD METHOD
try {
pst = con.prepareStatement(sql);
pst.setString(1, getName());
pst.setString(2, getNIC());
pst.setString(3, getAge());
pst.setString(4, getAddress());
pst.setString(5, getGender());
pst.setString(6, getMobile_num());
pst.setString(7, getSalary());
pst.setString(8, getTime());
pst.execute();
JOptionPane.showMessageDialog(null, "saved");
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
Page 38 of 49
[Project Report] [OOP Lab]
}
//DELETE METHOD
try {
pst.setString(1, id);
pst.execute();
JOptionPane.showMessageDialog(null, "DLETED");
del = true;
} catch (Exception e) {
return del;
// SEARCH METHOD
ResultSet rs = null;
try {
pst = con.prepareStatement(sql);
pst.setString(1, search);
Page 39 of 49
[Project Report] [OOP Lab]
rs = pst.executeQuery();
table.setModel(DbUtils.resultSetToTableModel(rs));
found = true;
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
return found;
//UPDATE METHOD
public boolean update(String id, String name, String nic, String age, String address, String gender, String mobno, String
Salary, String timing) {
try {
String sql = "update TrainerTable set Name='" + name + "',NIC='" + nic + "',Age='" + age + "',Address='" +
address + "',Gender='" + gender + "',MobileNo='" + mobno + "',Salary='" + Salary + "',Timing='" + timing + "' where
id='" + id + "'";
pst.execute();
update = true;
JOptionPane.showMessageDialog(null, "Updated");
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
return update;
try {
Page 40 of 49
[Project Report] [OOP Lab]
String sql = "select * from TrainerTable ";
ResultSet rs = pst.executeQuery();
table.setModel(DbUtils.resultSetToTableModel(rs));
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
Person:
package Gym_classes;
import javax.swing.JTable;
import net.proteanit.sql.DbUtils;
public Person(String name, String NIC, String Age, String Address, String Gender, String mobile_num, String time) {
this.name = name;
this.NIC = NIC;
this.Age = Age;
this.Address = Address;
this.Gender = Gender;
this.mobile_num = mobile_num;
this.time=time;
public Person() {
Page 41 of 49
[Project Report] [OOP Lab]
public String getName() {
return name;
return NIC;
return Age;
return Address;
return Gender;
return mobile_num;
return time;
Receipt:
package Gym_classes;
Page 42 of 49
[Project Report] [OOP Lab]
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
JTextField id;
JTextField name;
JTextField fees;
JTextField trainer;
this.id = id;
this.name = name;
this.fees =fees;
this.trainer = trainer;
ResultSet rs;
Page 43 of 49
[Project Report] [OOP Lab]
pst=con.prepareStatement(sql);
rs=pst.executeQuery();
while(rs.next()){
String add1=rs.getString("Name");
name.setText(add1);
String add2=rs.getString("Fees");
fees.setText(add2);
String add3=rs.getString("Trainer");
trainer.setText(add3);
JOptionPane.showMessageDialog(null, e);
Database View:
Page 44 of 49
[Project Report] [OOP Lab]
Login Table
Customer Table:
Equipment Table:
Trainer Table:
Output:
Page 45 of 49
[Project Report] [OOP Lab]
Page 46 of 49
[Project Report] [OOP Lab]
Page 47 of 49
[Project Report] [OOP Lab]
Page 48 of 49
[Project Report] [OOP Lab]
Conclusion:
Our intention to build a gym management system turned into an extreme level of curiosity when we were given
confidence by our teachers in creating such a system which could really solve real world problems and we had a
very common problem spotted in our minds regarding the topic of our project, it was really amazing to drive
solutions for a real world problem so that it can be easily tackled.
References
https://www.academia.edu/RegisterToDownload#Institution
https://www.academia.edu/26750275/Project_report_on_gym_management_system_proje
ct
https://www.w3schools.com/
Page 49 of 49