CS Project dam 2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 31

Project Report On

Gym Membership
Management
Computer Science Project

NAME : R. Jadon Jedidiah


CLASS : XII-F

ROLL NO :
SSVM WORLD SCHOOL
Department of Computer Science
Bonafide Certificate

I hereby certify that this project entitled Gym Membership Managment is


bonafide work done by R Jadon Jedidiah, XII – F
Registration
No:
In the Department of Computer Science of SSVM WORLD SCHOOL
under my supervision during the academic year 2024-25.

Date:
Signature of the Teacher In-Charge

Signature of the Principal

Submitted for Practical Examination held in the School Centre on

Internal Examiner School Seal External Examiner


ACKNOWLEDGEMENT

I would like to extend my heartfelt gratitude to my mentor and project guide,


Mr. Mujibullah Sir, for his unwavering support and guidance throughout the
course of this project. His genuine interest in my work, coupled with his
insightful advice and continuous encouragement, played a pivotal role in the
successful completion of this project.

I am also deeply thankful to Mrs. Manimekalai Mohan, our Correspondent


Madam, Mrs. P. Nimitha, our Senior Principal Madam, Mrs. Sheeja Saleem,
our Principal Madam, and Mrs. Radhika Bhojan, our Vice Principal Madam,
for their exceptional coordination and consistent support, which were
instrumental in facilitating the successful realization of this project.

My sincere thanks to my parents and friends for their constant motivation,


encouragement, and invaluable support throughout this journey.

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.

Finally, I wish to acknowledge and thank everyone who contributed, directly or


indirectly, to the successful completion of this project. Your help and support
have been greatly appreciated.

R Jadon Jedidiah
Class: XII-F
INDEX

S.No Contents Page No

1. Introduction 1

2. About Python IOLE 2

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.

Objective of the System:


The Gym Membership Management System is designed to provide an all-in-one
platform to handle critical functions like membership tracking, plan updates, and
billing calculations. The system ensures accuracy and efficiency while reducing
manual workload.

Core Features and Capabilities:

• Membership Overview:
View all available membership plans, including details such as plan duration,
cost, and benefits.

• Member Profile Management:


Add, update, or delete member information, ensuring accurate and up-to-date
records.

• Plan Upgrades and Adjustments:


Update or modify a member's subscription plan with ease, based on their
preferences or requirements.

• Billing Integration:
Automatically calculate bills based on the selected membership plan, including
additional charges or discounts.

• Detailed View Functionality:


Access comprehensive views of member profiles, plans, and payment history
at a glance.

Benefits of Implementation:

• Improved operational efficiency with automated processes.


• Accurate billing aligned with selected membership plans.
• Real-time updates for member details and subscriptions.
• Reduced administrative burden, allowing staff to focus on member
engagement.
This system aims to enhance the management of memberships, ensuring gyms
deliver exceptional service to their members while optimizing daily operations.

1
`
ABOUT PYTHON IDLE

Python is a versatile, high-level programming language widely used across


various domains. It was created by Guido van Rossum in 1991 and is now
maintained by the Python Software Foundation. Designed with a focus on
code readability, Python's syntax allows developers to write code efficiently
with fewer lines. It was developed as a successor to the ABC language and
Modula-3.

As a dynamically-typed and garbage-collected language, Python supports


multiple programming paradigms, including structured, object-oriented, and
functional programming. Known for its "batteries included" philosophy, Python
boasts an extensive standard library that simplifies many programming tasks.

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.

IDLE (Integrated Development and Learning Environment) is Python's default


IDE, included with its installer for Windows and macOS. Lightweight and
beginner-friendly, IDLE is cross-platform and designed to be intuitive for
educational purposes, avoiding unnecessary complexity.

In recent years, Python has outperformed other popular programming


languages such as C, C++, and Java in popularity and usage. Modern
companies primarily use Python 3.5 and later versions, benefiting from its
robust features and enhancements.

2
`
ABOUT MYSQL

MySQL is a popular open-source relational database management system


(RDBMS). Its name combines "My," after co-founder Michael Widenius's
daughter, and "SQL," which stands for Structured Query Language.

As an RDBMS, MySQL interacts with an operating system to manage


relational databases on a computer's storage system. It handles user
management, enables network access, and supports database integrity testing
and backup creation.

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.

The latest version of MySQL is MySQL 8.0, which includes significant


enhancements and features.

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.

Tkinter is implemented as a Python wrapper around a fully embedded Tcl


interpreter within the Python interpreter. When a Tkinter call is made, it is
translated into Tcl commands and processed by this embedded interpreter,
allowing Python and Tcl to coexist seamlessly in the same application.

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

Membership Data Table :

Structure:

Sample Data :

5
`
SOURCE CODE

# Importing Required Modules


import tkinter as tk
from tkinter import messagebox
from tkinter import ttk
import mysql.connector

# 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()

# Create database and users table


cursor.execute("CREATE DATABASE IF NOT EXISTS WARRIOR")
cursor.execute("use WARRIOR")

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
)
""")

cursor.execute("INSERT IGNORE INTO Users (Username, Password)


VALUES (%s, %s)", ("admin", "shakennotstired007"))
conn.commit()

# Function to calculate the bill


def calculate_bill(plan, trainer):
plan_prices = {
"Bronze Plan": 4000,
"Silver Plan": 10800,
"Gold Plan": 19200, 6
`
"Platinum Plan": 36000
}
bill = plan_prices.get(plan, 0)
if trainer == 'y':
bill += 2000 # Trainer fees
return bill

# Functions for Main Menu Actions


def view_members():
cursor.execute("SELECT * FROM BattalionMembersOnly")
result = cursor.fetchall()

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")

# Create a Treeview widget


columns = ("Name", "Phone_No", "Address", "Plan",
"Trainer", "Bill")
t = ttk.Treeview(members_window, columns=columns,
show="headings", height=15)

# Define headings and columns


t.heading("Name", text="Name")
t.heading("Phone_No", text="Phone No")
t.heading("Address", text="Address")
t.heading("Plan", text="Plan")
t.heading("Trainer", text="Trainer (y/n)")
t.heading("Bill", text="Bill (₹)")

t.column("Name", width=150, anchor="center")


t.column("Phone_No", width=120, anchor="center")
t.column("Address", width=200, anchor="center")
t.column("Plan", width=120, anchor="center")
t.column("Trainer", width=100, anchor="center")
t.column("Bill", width=100, anchor="center")

# Add data to the Treeview


for row in result:
t.insert("", tk.END, values=row)

t.pack(expand=True, fill=tk.BOTH, padx=10, pady=10)

# Add a vertical scrollbar


scrollbar = ttk.Scrollbar(members_window,
orient=tk.VERTICAL, command=tree.yview)
t.configure(yscroll=scrollbar.set)
scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
7
`
else:
messagebox.showinfo("View Members", "No members found!")

# Function to add details of a New Member


def add_member():
def save_member():
name = name_entry.get()
phone_no = int(phone_entry.get())
address = address_entry.get()
plan = plan_entry.get()
trainer = trainer_entry.get()
bill = calculate_bill(plan, trainer)

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")

tk.Label(add_member_window, text="Name:", font=("Arial", 12),


fg="white", bg="#333333").pack(pady=5)
name_entry = tk.Entry(add_member_window, font=("Arial", 12))
name_entry.pack(pady=5)

tk.Label(add_member_window, text="Phone No:", font=("Arial",


12), fg="white", bg="#333333").pack(pady=5)
phone_entry = tk.Entry(add_member_window, font=("Arial", 12))
phone_entry.pack(pady=5)

tk.Label(add_member_window, text="Address:", font=("Arial",


12), fg="white", bg="#333333").pack(pady=5)
address_entry = tk.Entry(add_member_window, font=("Arial", 12))
address_entry.pack(pady=5)

tk.Label(add_member_window, text="Plan (For Plans: Please View


Memberships Avaliable):", font=("Arial", 12), fg="white",
bg="#333333").pack(pady=5)
plan_entry = tk.Entry(add_member_window, font=("Arial", 12))
plan_entry.pack(pady=5)

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)

tk.Button(add_member_window, text="Add Member", font=("Arial",


12), bg="#FFD700", fg="#333333", command=save_member).pack(pady=20)

# Function to Update Member Details


def update_plan():
def fetch_member_details():
name = name_entry.get().strip()

# Fetch member details from the database


cursor.execute("SELECT * FROM BattalionMembersOnly WHERE
Name = %s", (name,))
member_details = cursor.fetchone()

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

# Display current details and entry fields for updates


tk.Label(update_plan_window, text=f"Current Name:
{current_name}", font=("Arial", 12), fg="white",
bg="#333333").pack(pady=5)
name_var.set(current_name)
tk.Entry(update_plan_window, textvariable=name_var,
font=("Arial", 12)).pack(pady=5)

tk.Label(update_plan_window, text=f"Current Phone No:


{current_phone}", font=("Arial", 12), fg="white",
bg="#333333").pack(pady=5)
phone_var.set(current_phone)
tk.Entry(update_plan_window, textvariable=phone_var,
font=("Arial", 12)).pack(pady=5)

tk.Label(update_plan_window, text=f"Current Address:


{current_address}", font=("Arial", 12), fg="white",
bg="#333333").pack(pady=5)
address_var.set(current_address)
9
`
tk.Entry(update_plan_window, textvariable=address_var,
font=("Arial", 12)).pack(pady=5)

tk.Label(update_plan_window, text=f"Current Plan:


{current_plan}", font=("Arial", 12), fg="white",
bg="#333333").pack(pady=5)
plan_var.set(current_plan)
tk.Entry(update_plan_window, textvariable=plan_var,
font=("Arial", 12)).pack(pady=5)

tk.Label(update_plan_window, text=f"Current Trainer (y/n):


{current_trainer}", font=("Arial", 12), fg="white",
bg="#333333").pack(pady=5)
trainer_var.set(current_trainer)
tk.Entry(update_plan_window, textvariable=trainer_var,
font=("Arial", 12)).pack(pady=5)

tk.Button(update_plan_window, text="Save Updates",


font=("Arial", 12), bg="#FFD700", fg="#333333",
command=save_updated_details).pack(pady=20)

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()

# To calculate new bill


updated_bill = calculate_bill(updated_plan,
updated_trainer)

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}")

# Variables to hold user inputs


name_var = tk.StringVar()
phone_var = tk.StringVar() 10
`
address_var = tk.StringVar()
plan_var = tk.StringVar()
trainer_var = tk.StringVar()

# Main window for updating details


update_plan_window = tk.Toplevel(main_menu)
update_plan_window.title("Update Member Details")
update_plan_window.geometry("500x600")
update_plan_window.configure(bg="#333333")

tk.Label(update_plan_window, text="Enter Member Name to


Update:", font=("Arial", 12), fg="white",
bg="#333333").pack(pady=5)
name_entry = tk.Entry(update_plan_window, font=("Arial", 12))
name_entry.pack(pady=5)

tk.Button(update_plan_window, text="Fetch Details",


font=("Arial", 12), bg="#FFD700", fg="#333333",
command=fetch_member_details).pack(pady=10)

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")

tk.Label(membership_window, text="MEMBERSHIP PLANS",


font=("Arial", 18, "bold"), fg="#FFD700",
bg="#333333").pack(pady=20)

# Define the plans


plans = [
"1. Bronze Plan - 1 Month (Price: ₹4,000)",
"2. Silver Plan - 3 Months (Price: ₹10,800 Save ₹1,200)",
"3. Gold Plan - 6 Months (Price: ₹19,200 Save ₹4,800)",
"4. Platinum Plan - 1 Year (Price: ₹36,000 Save ₹12,000)",
"For Trainer - ₹2,000"
]

# Display each plan


for plan in plans:
tk.Label(membership_window, text=plan, font=("Arial", 12),
fg="white", bg="#333333").pack(pady=5)

# Add a close button


tk.Button(membership_window, text="Close", font=("Arial", 12),
bg="#FFD700", fg="#333333",
command=membership_window.destroy).pack(pady=20)

11
`
# Main Menu GUI (Updated)
def show_main_menu():
global ma

# Function to delete a member


def delete_member():
def fetch_member_details():
name = name_entry.get().strip()

if not name:
messagebox.showerror("Error", "Please enter a valid
name.")
return

# Fetch member details


cursor.execute("SELECT * FROM BattalionMembersOnly WHERE
Name = %s", (name,))
result = cursor.fetchone()

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")

tk.Label(confirmation_window, text="Are you sure you want


to delete this member?",
font=("Arial", 12), fg="white",
bg="#333333").pack(pady=10)

# 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()

tk.Button(confirmation_window, text="Yes", font=("Arial",


12), bg="#FFD700", fg="#333333",
command=confirm_yes).pack(side=tk.LEFT, padx=50,
pady=20)

tk.Button(confirmation_window, text="No", font=("Arial",


12), bg="#FFD700", fg="#333333",
command=confirm_no).pack(side=tk.RIGHT, padx=50,
pady=20)

# Main Delete Member Window


delete_member_window = tk.Toplevel(main_menu)
delete_member_window.title("Delete Member")
delete_member_window.geometry("400x400")
delete_member_window.configure(bg="#333333")

tk.Label(delete_member_window, text="Enter the Name of Member


to Delete:",
font=("Arial", 12), fg="white",
bg="#333333").pack(pady=5)
name_entry = tk.Entry(delete_member_window, font=("Arial", 12))
name_entry.pack(pady=5)

tk.Button(delete_member_window, text="Fetch Member Details",


font=("Arial", 12),
bg="#FFD700", fg="#333333",
command=fetch_member_details).pack(pady=10)

details_label = tk.Label(delete_member_window, text="",


font=("Arial", 12),
fg="white", bg="#333333",
justify=tk.LEFT)
details_label.pack(pady=10)

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")

tk.Label(main_menu, text="WARRIORS GYM", font=("Arial", 16,


"bold"), fg="#FFD700", bg="#222222").pack(pady=20)

tk.Button(main_menu, text="View Members", font=("Arial", 12),


bg="#FFD700", fg="#333333", command=view_members).pack(pady=10)
tk.Button(main_menu, text="Add Member", font=("Arial", 12),
bg="#FFD700", fg="#333333", command=add_member).pack(pady=10)
tk.Button(main_menu, text="Update Details", font=("Arial", 12),
bg="#FFD700", fg="#333333", command=update_plan).pack(pady=10)
tk.Button(main_menu, text="Delete Member", font=("Arial", 12),
bg="#FFD700", fg="#333333", command=delete_member).pack(pady=10)
tk.Button(main_menu, text="Memberships Available",
font=("Arial", 12), bg="#FFD700", fg="#333333",
command=show_membership_plans).pack(pady=10) # New Button
tk.Button(main_menu, text="Exit", font=("Arial", 12),
bg="#FFD700", fg="#333333",
command=main_menu.destroy).pack(pady=10)

main_menu.mainloop()

# Login Page Function


def validate_login():
username = username_entry.get()
password = password_entry.get()

cursor.execute("SELECT * FROM Users WHERE Username = %s AND


Password = %s", (username, password))
result = cursor.fetchone()

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")

tk.Label(login_window, text="WARRIORS GYM LOGIN", font=("Arial",


30, "bold"), fg="#FFD700", bg="#333333").pack(pady=20)

tk.Label(login_window, text="Username:", font=("Arial", 12),


fg="white", bg="#333333").pack(pady=5)
username_entry = tk.Entry(login_window, font=("Arial", 12))
username_entry.pack(pady=5)

tk.Label(login_window, text="Password:", font=("Arial", 12),


fg="white", bg="#333333").pack(pady=5)
password_entry = tk.Entry(login_window, font=("Arial", 12),
show="*")
password_entry.pack(pady=5)

tk.Button(login_window, text="Login", font=("Arial", 14),


bg="#FFD700", fg="#333333", command=validate_login).pack(pady=20)

login_window.mainloop()

# Closing connection
cursor.close()
conn.close()

15
`
OUTPUT
Account Login Screen:
a) On startup

b) Incorrect Login Details

c) Correct Details Provided

16
`
GMMS Main Menu Screen

View Members Page

17
`
View Add Member Page

On Adding Member

18
`
Update Members Page

After Saving Updates

19
`
Delete Member Menu

Confirmation Page

20
`
(a)If “NO” is selected:

(b)If “YES” 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

• Python 3.x installed on your system.


• MySQL installed and running with the following configurations:
◦ localhost as the host.
◦ root as the user.
◦ A password for the root user (the password used in this code is
Newappleidpassword@2022, but you should modify this to match your
MySQL root password).
Installation

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.

Features and Functionality

1. Login Screen

• Purpose: Allows users to log in with a username and password.


• Username: admin (default).
• Password: shakennotstired007 (default).
• Once the user logs in successfully, the main menu will be displayed.
2. Main Menu

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:

• Bronze Plan: ₹4,000 (1 Month)


• Silver Plan: ₹10,800 (3 Months, Save ₹1,200)
• Gold Plan: ₹19,200 (6 Months, Save ₹4,800)
• Platinum Plan: ₹36,000 (1 Year, Save ₹12,000)
• Trainer Fee: ₹2,000 (if selected)

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 (₹)

6. Update Member Details

• 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

• Search for Member: Enter the name of the member to delete.


• Confirm Deletion: A confirmation window appears. You can cancel or proceed with
the deletion.

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:

◦ The user enters the member’s information.


◦ The calculate_bill() function calculates the bill based on the selected plan
and trainer choice

4. View Members:

◦ Displays a table with the details of all members.


◦ Data is fetched from the BattalionMembersOnly table

5. Update Member:

◦ The user searches for a member by name.


◦ Their current details are displayed, and the user can modify them.
◦ After updating, the new details are saved in the database

6. Delete Member:

◦ The user searches for a member by name.


◦ If found, their details are displayed, and the user can confirm deletion.

24
`
How to Use

Login:

1. Username: Enter admin


2. Password: Enter shakennotstired007
3. Click Login.

Main Menu Actions:

1. View Members: Click this button to see a list of all members.


2. Add Member: Enter the member's details, select the plan and trainer, and click Add
Member to save.
3. Update Details: Search for a member by name, edit their details, and save the
updates.
4. Delete Member: Search for the member to delete, confirm deletion, and the member
will be removed from the database.
5. Memberships Available: View the available plans and prices

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:

◦ Username (VARCHAR(50)): The unique username for the login.


◦ Password (VARCHAR(50)): The password for login.
2. BattalionMembersOnly Table:

◦ Name (VARCHAR(30)): Member's name.


◦ Phone_No (BIGINT): Member's phone number.
◦ Address (VARCHAR(255)): Member's address.
◦ Plan (VARCHAR(20)): Selected plan.
◦ Trainer (CHAR(1)): Whether the member has a trainer (y or n).
◦ Bill (INT): The bill calculated based on the plan and trainer choice.

25
`
CONCLUSION

Working on this project has been an incredibly enriching experience.


Throughout the process, I had the opportunity to deepen my understanding of
Python and MySQL, while also gaining valuable insights into frontend design.
Exploring the various features of Tkinter and learning how to integrate them
effectively has been particularly rewarding.

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.

Overall, this has been a fantastic learning journey, significantly enhancing my


problem-solving abilities and offering me a clearer perspective on how to apply
theoretical knowledge in real-world scenarios. I truly enjoyed investing my time
and effort into this project, and I hope it proves to be both engaging and
beneficial.

R. Jadon Jedidiah
Class: XII F

26
`
BIBLIOGRAPHY

1. Computer Science with Python, Class XII Textbook by


Sumita Arora, 2021 Edition, Published by Dhanpat Rai &
Co. 2022
2. Python.10.9 Documentation, https://docs.python.org/3/
3. MySQL 8.0 Reference Manual, https://
dev.mysql.com/doc/refman/8.0/en/
4. GeeksForGeeks, https://geeksforgeeks.org
5. Wikipedia, https://wikipedia.org
6. W3Schools, https://w3schools.com/python/
7. StackOverflow, https://stackoverflow.com
8. Perplexity, https://perplexity.ai
9. ChatGPT, https://chatgpt.com/

27
`

You might also like