CS Project dam 2
CS Project dam 2
CS Project dam 2
Gym Membership
Management
Computer Science Project
ROLL NO :
SSVM WORLD SCHOOL
Department of Computer Science
Bonafide Certificate
Date:
Signature of the Teacher In-Charge
I would also like to express my gratitude to CBSE for providing me with the
opportunity to undertake such an impactful project, without which this
endeavor would not have been possible.
R Jadon Jedidiah
Class: XII-F
INDEX
1. Introduction 1
3 About MySQL 3
4. About Tkinter 3
5. Requirements 4
6. MySQL Table Structure 5
7. Source Code 7
6
8. Output 34
16
9. User Manual 43
22
10. Conclusion 44
26
11. Bibliography 45
27
INTRODUCTION
Managing memberships efficiently is essential for the smooth operation of gyms and
fitness centers. Without a proper system, tracking member details, updating plans,
and ensuring accurate billing can become cumbersome. A Gym Membership
Management System (GMMS) simplifies these tasks, offering a streamlined
solution for administrators and an enhanced experience for members.
• Membership Overview:
View all available membership plans, including details such as plan duration,
cost, and benefits.
• Billing Integration:
Automatically calculate bills based on the selected membership plan, including
additional charges or discounts.
Benefits of Implementation:
1
`
ABOUT PYTHON IDLE
Python 1.0 was introduced in 1994, featuring tools like lambda, map, filter, and
reduce. In 2000, Python 2.0 added innovations such as list comprehensions
and an improved garbage collection system. Python 3.0 (released in 2008),
often referred to as Py3k, was developed to address core design flaws in the
earlier versions.
2
`
ABOUT MYSQL
MySQL is written in C and C++, with its SQL parser developed using yacc and
a custom-built lexical analyzer. It is compatible with numerous platforms,
including AIX, FreeBSD, Linux, macOS, Microsoft Windows, Oracle Solaris,
and many more. Additionally, a port for OpenVMS is available.
ABOUT TKINTER
Tkinter is Python's binding to the Tk GUI toolkit and serves as the default
graphical user interface (GUI) library for Python. It is included with standard
installations of Python on Linux, Windows, and macOS. As free software,
Tkinter is released under the Python license.
The name "Tkinter" stands for "Tk interface." It was initially developed by
Steen Lumholt and Guido van Rossum and later improved by Fredrik Lundh.
3
`
REQUIREMENTS
Hardware Requirements:
• Minimum 2GB RAM (16 GB used)
• Minimum 256GB SSD
Software Requirements:
• MacBook Pro (2022 Version) [Apple Silicon - M2]
• Python 3.x IDLE
• Python Modules Required:
i. MySQL Connector Module*
ii. Tkinter Module
[Modules marked * are not part of Python’s standard library and require separate
installation]
4
`
MYSQL TABLE STRUCTURE
Structure:
Sample Data :
5
`
SOURCE CODE
# Database connection
conn = mysql.connector.connect(host="localhost", user="root",
password="Newappleidpassword@2022")
if conn.is_connected():
print("Connected to MySQL server")
cursor = conn.cursor()
cursor.execute("""
CREATE TABLE IF NOT EXISTS Users (
Username VARCHAR(50) PRIMARY KEY,
Password VARCHAR(50) NOT NULL
)
""")
cursor.execute("""
CREATE TABLE IF NOT EXISTS BattalionMembersOnly (
Name VARCHAR(30),
Phone_No BIGINT,
Address VARCHAR(255),
Plan VARCHAR(20),
Trainer CHAR(1),
Bill INT
)
""")
if result:
# Create a new window for viewing members
members_window = tk.Toplevel(main_menu)
members_window.title("View Members")
members_window.geometry("800x400")
members_window.configure(bg="#333333")
cursor.execute("""
INSERT INTO BattalionMembersOnly (Name, Phone_No,
Address, Plan, Trainer, Bill)
VALUES (%s, %s, %s, %s, %s, %s)
""", (name, phone_no, address, plan, trainer, bill))
conn.commit()
messagebox.showinfo("Add Member", f"{name} added
successfully!")
add_member_window.destroy()
add_member_window = tk.Toplevel(main_menu)
add_member_window.title("Add Member")
add_member_window.geometry("400x400")
add_member_window.configure(bg="#333333")
8
`
tk.Label(add_member_window, text="Trainer (y/n):",
font=("Arial", 12), fg="white", bg="#333333").pack(pady=5)
trainer_entry = tk.Entry(add_member_window, font=("Arial", 12))
trainer_entry.pack(pady=5)
if member_details:
display_current_details(member_details)
else:
messagebox.showerror("Error", "Member not found!")
update_plan_window.destroy()
def display_current_details(details):
# Extract details
global current_name, current_phone, current_address,
current_plan, current_trainer
current_name, current_phone, current_address, current_plan,
current_trainer, current_bill = details
def save_updated_details():
updated_name = name_var.get()
updated_phone = phone_var.get()
updated_address = address_var.get()
updated_plan = plan_var.get()
updated_trainer = trainer_var.get()
try:
# Update the member details in the database
cursor.execute("""
UPDATE BattalionMembersOnly
SET Name = %s, Phone_No = %s, Address = %s, Plan =
%s, Trainer = %s, Bill = %s
WHERE Name = %s
""", (updated_name, updated_phone, updated_address,
updated_plan, updated_trainer, updated_bill, current_name))
conn.commit()
messagebox.showinfo("Update Successful", f"Details for
'{current_name}' updated successfully!")
update_plan_window.destroy()
except mysql.connector.Error as err:
messagebox.showerror("Error", f"Failed to update
details: {err}")
def show_membership_plans():
# Create a new window for displaying membership plans
membership_window = tk.Toplevel(main_menu)
membership_window.title("Membership Plans")
membership_window.geometry("500x400")
membership_window.configure(bg="#333333")
11
`
# Main Menu GUI (Updated)
def show_main_menu():
global ma
if not name:
messagebox.showerror("Error", "Please enter a valid
name.")
return
if result:
# Display member details
details_text = (
f"Name: {result[0]}\n"
f"Phone No: {result[1]}\n"
f"Address: {result[2]}\n"
f"Plan: {result[3]}\n"
f"Trainer (y/n): {result[4]}\n"
f"Bill: ₹{result[5]}"
)
details_label.config(text=details_text)
select_user_button.config(state=tk.NORMAL)
else:
messagebox.showerror("Error", "Member not found!")
details_label.config(text="")
select_user_button.config(state=tk.DISABLED)
def confirm_deletion():
confirmation_window = tk.Toplevel(delete_member_window)
confirmation_window.title("Confirm Deletion")
confirmation_window.geometry("400x200")
confirmation_window.configure(bg="#333333")
# Confirmation options
def confirm_yes():
12
`
cursor.execute("DELETE FROM BattalionMembersOnly WHERE
Name = %s", (name_entry.get(),))
conn.commit()
messagebox.showinfo("Delete Member", f"Member
'{name_entry.get()}' deleted successfully!")
confirmation_window.destroy()
delete_member_window.destroy()
def confirm_no():
messagebox.showinfo("Delete Member", "Deletion
canceled.")
confirmation_window.destroy()
select_user_button = tk.Button(delete_member_window,
text="Confirm Deletion", font=("Arial", 12),
bg="#FFD700", fg="#333333",
command=confirm_deletion, state=tk.DISABLED)
select_user_button.pack(pady=10)
13
`
# Main Menu GUI
def show_main_menu():
global main_menu
login_window.destroy()
main_menu = tk.Tk()
main_menu.title("Gym Management System - Main Menu")
main_menu.geometry("800x800")
main_menu.configure(bg="#222222")
main_menu.mainloop()
if result:
messagebox.showinfo("Login Successful", "Welcome to the Gym
Management System!")
show_main_menu()
else:
messagebox.showerror("Login Failed", "Invalid username or
password. Please try again.")
# Login UI
login_window = tk.Tk() 14
`
login_window.title("Gym Management System - Login")
login_window.geometry("4800x800")
login_window.configure(bg="#333333")
login_window.mainloop()
# Closing connection
cursor.close()
conn.close()
15
`
OUTPUT
Account Login Screen:
a) On startup
16
`
GMMS Main Menu Screen
17
`
View Add Member Page
On Adding Member
18
`
Update Members Page
19
`
Delete Member Menu
Confirmation Page
20
`
(a)If “NO” is selected:
Memberships Avaliable
21
`
USER MANUAL
Overview
This Gym Management System is a simple graphical user interface (GUI) application built
using Python's tkinter library and MySQL for database management. It allows users to
manage gym memberships, including viewing members, adding new members, updating
their plans, and deleting members. The system also includes a login page, membership
plans, and billing calculation.
Requirements
1.
1. Install the necessary Python packages:
pip install tkinter mysql-connector
2.
3.
2. Set up a MySQL database named WARRIOR:
◦ The script automatically creates the WARRIOR database and two tables,
Users and BattalionMembersOnly, if they do not already exist.
3.
4. Modify the connection details (host, user, password) in the script to match your own
database configuration.
1. Login Screen
After a successful login, the main menu provides the following options:
• View Members: Opens a window to display a list of all members in the gym.
• Add Member: Allows you to add a new member by entering their details (Name,
Phone Number, Address, Plan, and Trainer).
22
`
• Update Details: Allows you to update a member's information (Name, Phone
Number, Address, Plan, and Trainer).
• Delete Member: Allows you to delete a member from the database.
• Memberships Available: Displays available gym membership plans and their prices.
• Exit: Closes the application.
3. Membership Plans
When the Memberships Available option is selected, the following plans are displayed:
4. Add Member
• Input Fields:
◦ Name
◦ Phone Number
◦ Address
◦ Plan (from available plans)
◦ Trainer (Yes/No)
• Action: Upon clicking "Add Member," the member's details are stored in the
database, and a bill is calculated based on the selected plan and trainer choice
5. View Members
• Displays a list of all members in a scrollable table with the following columns:
◦ Name
◦ Phone Number
◦ Address
◦ Plan
◦ Trainer (y/n)
◦ Bill (₹)
• Search Member: Enter the member’s name to search for existing details.
• Update Fields: Modify the Name, Phone Number, Address, Plan, and Trainer
options.
• Calculate Bill: The bill is recalculated based on the new plan and trainer selection.
• Save Updates: The member details are updated in the database.
7. Delete Member
23
`
Code Flow
1. Database Setup:
◦ The script connects to a MySQL database and creates the necessary tables if
they don't exist.
◦ The Users table holds login credentials.
◦ The BattalionMembersOnly table stores member details (name, phone,
address, plan, trainer, and bill)
2. Main Menu:
◦ After a successful login, the main menu provides buttons for various actions
(view, add, update, delete members, etc.).
◦ Each action opens a new window with the relevant form or display
3. Add Member:
4. View Members:
5. Update Member:
6. Delete Member:
24
`
How to Use
Login:
Logout:
To exit the application, click the Exit button in the main menu.
Troubleshooting
• Database Connection Errors: Ensure MySQL is running and the credentials in the
code are correct.
• Incorrect Login: Double-check the username and password. If using a different
user, update the database accordingly.
• No Data Found: Ensure there are members added to the BattalionMembersOnly
table.
Database Schema
1. Users Table:
25
`
CONCLUSION
This project also helped me grasp the importance of thoroughly analyzing and
breaking down a problem before diving into its solution. I have learned not only
the technical skills required for development but also how to approach
complex tasks in a structured and methodical manner.
R. Jadon Jedidiah
Class: XII F
26
`
BIBLIOGRAPHY
27
`