Main Project
Main Project
import mysql.connector as c
import datetime
conn=c.connect(host='localhost',user='root',passwd='a',database='radiant_coaching_c
entre')
m=conn.cursor()
def login():
u=input('Enter username-> ')
p=input('Enter passwd-> ')
q1="select * from login where username='{}' and passwd='{}'".format(u,p)
m.execute(q1)
m.fetchall()
if m.rowcount==1:
print('login successfully.....')
print('-----------------------------------------------------')
main_menu()
else:
print('login failed!!!')
def main_menu():
print("-------------------1.Registration ----------------------- ")
print("-------------------2.Batch INFO-------------------------- ")
print("-----------------3.Student Details----------------------- ")
print("-----------------4.Faclty Management--------------------- ")
print("--------------------5.EXIT------------------------------- ")
a=input("Enter option you have selected-> ")
if a=="1":
print("----------------------------------------------------------------------------
------------------")
print("----------Choose the option you have to perform on table
registration-------------------------")
print("-------------- 1. register_student-------------------------")
print("--------------2. view_registration-------------------------")
print("--------------3. updation_payment_status-------------------")
print("--------------4. delete_registration-----------------------")
x=input("Enter option you have to select-> ")
if x=="1":
stud_name=input("Enter the stud_name-> ")
fath_name=input("Enter the fath_name-> ")
moth_name=input("Enter the moth_name-> ")
phone=input("Enter the mobile number of parent-> ")
email=input("Enter the your email-> ")
address=input("Enter the address of your house-> ")
session = datetime.datetime.now().year
academic_session= (f"{session}-{session+1}")
print("----------------------------------------------------------------------------
-----------")
if b=="2":
course="JEE"
clas=input("Enter the class you haveto take admission-> ")
if clas=="11":
f=int(input("Enter the percentage you have scored in class
10th->"))
if f>=89:
batch_id="B004"
batch_name="STR_J1"
print("You have allotted the batch 'STR_J1'")
print("Installment-I will be -> Rs. 15000 ")
print("Installment-II will be -> Rs. 20000")
print("Installment-III will be -> Rs. 28000")
print("Your overall fee will be -> Rs. 63000 ")
print("Your section will be -> A")
section="A"
else:
batch_id="B006"
batch_name="SCHl_J1"
print("You have allotted the batch 'SCHL_J1'")
print("Installment-I will be -> Rs. 12000 ")
print("Installment-II will be -> Rs. 18000 ")
print("Installment-III will be -> Rs. 25000 ")
print("Your overall fee will be -> Rs. 55000")
print("Your section will be -> C")
section="C"
elif clas=="12":
f=int(input("Enter the percentage you have scored in class
11th->"))
if f>=80:
batch_id="B007"
batch_name="STR_J2"
print("You have allotted the batch 'STR_J2'")
print("Installment-I will be -> Rs. 10000 ")
print("Installment-II will be -> Rs. 15000 ")
print("Installment-III will be -> Rs. 20000 ")
print("Your overall fee will be -> Rs. 45000 ")
print("Your section will be -> A")
section="A"
else:
batch_id="B009"
batch_name="SCHl_J2"
print("You have alotted the batch 'SCHL_J2'")
print("Installment-I will be -> Rs. 11000 ")
print("Installment-II will be -> Rs. 16000 ")
print("Installment-III will be -> Rs. 24000 ")
print("Your overall fee will be -> Rs. 51000")
print("Your section will be -> C")
section="C"
elif b=="1":
course="NEET"
clas=input("Enter the class you haveto take admission-> ")
if clas=="11":
f=int(input("Enter the percentage you have scored in class
10th-> "))
if f>=89:
batch_id="B001"
batch_name="STR_N1"
print("You have allotted the batch 'STR_N1'")
print("Installment-I will be -> Rs. 10000 ")
print("Installment-II will be -> Rs. 15000 ")
print("Installment-III will be -> Rs. 20000 ")
print("Your overall fee will be -> Rs. 45000 ")
print("Your section will be -> D")
section="D"
elif clas=="12":
f=int(input("Enter the percentage you have scored in class
11th->"))
if f>=80:
batch_id="B0010"
batch_name="STR_N2"
print("You have allotted the batch 'STR_N2'")
print("Installment-I will be -> Rs. 10000 ")
print("Installment-II will be -> Rs. 15000 ")
print("Installment-III will be -> Rs. 20000 ")
print("Your overall fee will be -> Rs. 45000 ")
print("Your section will be -> D")
section="D"
else:
batch_id="B0012"
batch_name="SCHL_N2"
print("You have allotted the batch 'SCHL_N2'")
print("Installment-I will be -> Rs. 15000 ")
print("Installment-II will be -> Rs. 20000 ")
print("Installment-III will be -> Rs. 28000 ")
print("Your overall fee will be -> Rs. 63000")
print("Your section will be-> F ")
section="F"
else:
print("Wrong input enter again")
main_menu()
print("Payment Status")
print("1. Paid")
print("2. Pending")
print("CHOOSE 1 for PAID and 2 for PENDING")
i1= input("Installment 1: ")
i2 = input("Installment 2: ")
i3 =input("Installment 3: ")
if i1=="1":
instl_I_pay="PAID"
else:
instl_I_pay="PENDING"
if i2=="1":
instl_II_pay="PAID"
else:
instl_II_pay="PENDING"
if i3=="1":
instl_III_pay="PAID"
else:
instl_III_pay="PENDING"
stud_details(stud_name,email,phone,address,course,moth_name,fath_name,batch_id,batc
h_name,section,clas,academic_session)
stud="SELECT stud_id FROM stud_info where stud_name='{}' AND
email='{}'".format(stud_name,email)
m.execute(stud)
result=m.fetchone()
if result:
stud_id = result[0]
print("Registration ID:", stud_id)
else:
print("Registration not found.")
reg_date= datetime.date.today()
reg_details(stud_name,clas,course,reg_date,phone,batch_id,batch_name,instl_I_pay,in
stl_II_pay,instl_III_pay,stud_id)
main_menu()
elif x=="2":
reg_id=input("ENTER YOUR REGISTRATION ID-> ")
print("----------------------------------------------------------------------------
-----------------------")
view_reg_details(reg_id)
main_menu()
elif x=="3":
print("----------------------------------------------------------------------------
------------------------")
reg_id=input("ENTER YOUR REGISTRATION ID-> ")
print("Payment Status")
print("1. Paid")
print("2. Pending")
print("CHOOSE 1 for PAID and 2 for PENDING")
i1= input("Installment 1: ")
i2 = input("Installment 2: ")
i3 = input("Installment 3: ")
if i1=="1":
instl_I_pay="PAID"
else:
instl_I_pay="PENDING"
if i2=="1":
instl_II_pay="PAID"
else:
instl_II_pay="PENDING"
if i3=="1":
instl_III_pay="PAID"
else:
instl_III_pay="PENDING"
update_payment_status(reg_id,instl_I_pay,instl_II_pay,instl_III_pay )
main_menu()
elif x=="4":
print("----------------------------------------------------------------------------
------------------------")
print("------------------------ ARE YOU SURE YOU WANT TO DELETE YOUR
REGISTRATION??? ----------------------")
print("----------------------------------------------------------------------------
------------------------")
k=input("--------------------------- IF YES TYPE 1 OR IF NO TYPE 2 ->
")
print("----------------------------------------------------------------------------
------------------------")
if k=="1":
print("---------------------------DELETION OF REGISTRATION ABOUT TO
START->---------------------------")
reg_id=input("ENTER THE REGISTRATION ID-> ")
delete_registration(reg_id)
main_menu()
elif k=="2":
print("--------------------------------------------------------------")
print("------------------ PROGRAM ENDED
-----------------------------")
print("--------------------------------------------------------------")
main_menu()
else:
print("------------------ INVALID SYNTAX
---------------------------")
k=("--------------IF YES TYPE 1 OR IF NO TYPE 2 -
>------------------")
elif a=="2":
print("----------------------------------------------------------------------------
------------------")
print("-----------Choose the option you have to perform on table
batch_info--------------------------")
print("---------------------1.Update Batch
Timing()----------------------------------------------------")
print("----------------------2.Update Batch Time
Slot(morning,afternoon,evening)---------------------")
print("-----------------3.Update Number of
Faculties-------------------------------------------------")
print("---------------------------- 4. EXIT
--------------------------------------------")
print("----------------------------------------------------------------------------
------------------")
if y=="1":
print("----------------------------------------------------------------------------
--------------")
print("-------------------------PROCESSING UPDATION OF
TIMING------------------------------------")
print("----------------------------------------------------------------------------
--------------")
update_batch_timing()
main_menu()
elif y=="2":
print("----------------------------------------------------------------------------
--------------")
print("-------------------------PROCESSING UPDATION OF TIME
SLOT---------------------------------")
print("----------------------------------------------------------------------------
--------------")
update_batch_time_slot()
main_menu()
elif y=="3":
print("----------------------------------------------------------------------------
--------------")
print("------------------PROCESSING UPDATION OF NUMBER OF FACULTIES
WORKING----------------------")
print("----------------------------------------------------------------------------
--------------")
update_num_faculties()
main_menu()
elif y=="4":
print("------------------------------- EXITING
----------------------------------------")
print("----------------------------------------------------------------------------
--------")
print("-------------------------------- DONE
-------------------------------------")
main_menu()
else:
print("........... INVALID CHOICE .............")
y=input("Enter choice (1-3) -> ")
elif a=="3":
print("----------------------------------------------------------------------------
------------------")
print("---------------------------- 1. View details of students
------------------------")
print("-------------- 2. Update student details( Mobile
number,Email,Address ) -------------------")
w=input("Enter choice (1/2) -> ")
if w=="1":
print("")
stud_id=input("Enter Student ID: ")
view_student_details(stud_id)
main_menu()
elif w=="2":
print("Updating Student Details... ")
stud_id = input("Enter Student ID: ")
if choice == "1":
phone = input("Enter new mobile number: ")
if len(phone) == 10:
print("Valid mobile number")
else:
print("Invalid mobile number. Please enter 10 digits.")
phone=input("Enter the mobile number of parent-> ")
if len(phone) == 10:
print("Valid mobile number")
else:
print("Invalid mobile number. Please enter 10 digits.")
phone=input("Enter the mobile number of parent-> ")
else:
print("Invalid choice.")
main_menu()
elif a=="4":
print("----------------------------------------------------------------------------
--")
print("----------Choose the option you have to perform on table
fac_info-------------")
print("-------------------- 1.Add Faculty
-----------------------------")
print("--------- 2.Update Faculty details (Address, Salary, Subjects)
----------")
print("------------------ 3.Delete Faculty
----------------------------")
print("------------------ 4. View Faculty Details
---------------------------")
print("---------------------- 5.EXIT
---------------------------")
print("----------------------------------------------------------------------------
-")
t=input("Enter choice (1-4) -> ")
if t=="1":
fac_name=input("Enter the name of faculty joining -> ")
phone=input("Enter the mobile number of faculty joining -> ")
if len(phone) == 10:
print("Valid mobile number")
else:
print("Invalid mobile number. Please enter 10 digits.")
phone=input("Enter the mobile number of parent-> ")
else:
print(" ")
n=input(" Enter 1 to continue or 2 to exit. Any other key
returns to the main menu. ")
if n=="1":
c=input("*********** PRESS 1 FOR JEE & 2 FOR NEET
*****************")
s=input("********* PRESS 1 for maths , 2 for physics , 3 for
chemistry & 4 for biology ************")
elif n=="2":
print("----------------------------------------------------------------------------
------------")
print("------------------ Exiting program...... Thank
you!!! ------------------------")
print("----------------------------------------------------------------------------
------------")
else:
main_menu()
main_menu()
elif t=="2":
print("----------------------------------------------------------------------------
--------")
print("------------ IF YOU WANT TO UPDATE PRESS THE KEY AS PER
REQUIRED ---------------")
print("Which field would you like to update?")
print("1. Address")
print("2. Salary")
print("3. Subjects")
print("4. All Three")
elif z=="2":
sal=input("Enter the new salary-> ")
query = "UPDATE fac_info SET sal = {} WHERE fac_id =
{}".format(sal,fac_id)
m.execute(query)
conn.commit()
print("Faculty Details are updated successfully.")
elif z=="3":
subj=input("Enter the new subject-> ")
query = "UPDATE fac_info SET subj= '{}' WHERE fac_id =
{}".format(subj,fac_id)
m.execute(query)
conn.commit()
print("Faculty Details are updated successfully.")
elif z=="4":
address=input("Enter the new adress-> ")
sal=input("Enter the new salary-> ")
subj=input("Enter the new subject-> ")
query = "UPDATE fac_info SET subj= '{}',sal={},address='{}' WHERE
fac_id = {}".format(subj,sal,address,fac_id)
m.execute(query)
conn.commit()
print("Faculty Details are updated successfully.")
else:
main_menu()
main_menu()
elif t=="3":
fac_id=input("Enter Faculty ID for Deletion-> ")
v=input("Confirm delete the Faculty details.. (y/n): ")
if v=="y" or v=="Y":
delete_faculty(fac_id)
main_menu()
else:
main_menu()
elif t=="4":
print("Faculty Details: ")
fac_id=input("Enter Faculty ID-> ")
view_faculty_details(fac_id)
main_menu()
elif t=="5":
print("------------------------------- EXITING
----------------------------------------")
print("----------------------------------------------------------------------------
--------")
print("-------------------------------- DONE
------------------------------------")
main_menu()
else:
print("INVALID OPTION.....")
print("RESTARTING")
t=input("Enter serial number of option you have to perform on table of
faculty details")
elif a=="5":
print("----------------------------------------------------------------------------
------------")
print("------------------ Exiting program...... Thank you!!!
------------------------")
print("----------------------------------------------------------------------------
------------")
else:
print("*************** INVALID CHOICE TRY AGAIN ENTER CORRECT CHOICE
************************")
main_menu()
def reg_details
(stud_name,clas,course,reg_date,phone,batch_id,batch_name,instl_I_pay,instl_II_pay,
instl_III_pay,stud_id):
q2="insert into reg_details values (NULL,'{}',
{},'{}','{}','{}','{}','{}','{}','{}','{}',{})".format
(stud_name,clas,course,reg_date,phone,batch_id,batch_name,instl_I_pay,instl_II_pay,
instl_III_pay,stud_id)
m.execute(q2)
reg_id=m.lastrowid
print("Generated Registration ID:", reg_id)
conn.commit()
print("----------------------------------------------------------------------------
---------------------")
print("----------------------------------
DONE,THANKYOU!!!-----------------------------------------------")
def view_reg_details(reg_id):
q3 = "SELECT * FROM reg_details WHERE reg_id = {}".format(reg_id)
m.execute(q3)
print("----------------------------------------------------------------------------
--------------------")
result = m.fetchone()
if result:
print(result)
else:
print("No record found with reg_id =", reg_id)
print("----------------------------------------------------------------------------
-------------------")
print("----------------------------------
DONE,THANKYOU!!!---------------------------------------------")
def
stud_details(stud_name,email,phone,address,course,moth_name,fath_name,batch_id,batc
h_name,section,clas,academic_session):
q4="insert into stud_info
values(NULL,'{}','{}','{}','{}','{}','{}','{}','{}','{}','{}',
{},'{}')".format(stud_name,email,phone,address,course,moth_name,fath_name,batch_id,
batch_name,section,clas,academic_session)
m.execute(q4)
stud_id=m.lastrowid
print("Generated Student ID:", stud_id)
conn.commit()
print("----------------------------------------------------------------------------
-------------------")
print("----------------------------------
DONE,THANKYOU!!!---------------------------------------------")
def update_batch_timing():
batch_id = input("Enter batch ID-> ")
timing = input("Enter new timing-> ")
q5= "UPDATE batch_info SET timing = '{}' WHERE batch_id =
'{}'".format(timing,batch_id)
m.execute(q5)
conn.commit()
print("----------------------------------------------------------------------------
--------------------")
print("----------------------------Batch timing updated
successfully.----------------------------------")
def update_batch_time_slot():
batch_id = input("Enter batch ID-> ")
time_slot = input("Enter new time slot-> ")
q6= "UPDATE batch_info SET Time_slot = '{}' WHERE batch_id =
'{}'".format(time_slot,batch_id)
m.execute(q6)
conn.commit()
print("----------------------------------------------------------------------------
---------------------")
print("----------------------------Batch time slot updated
successfully.--------------------------------")
def update_num_faculties():
batch_id = input("Enter batch ID: ")
num_faculty = int(input("Enter new number of faculties: "))
q7= "UPDATE batch_info SET Num_Faculty = {} WHERE batch_id =
'{}'".format(num_faculty,batch_id)
m.execute(q7)
conn.commit()
print("----------------------------------------------------------------------------
-----")
print("-----------------Number of faculties updated
successfully.-----------------------")
def delete_registration(reg_id):
q8 = ("DELETE FROM reg_details WHERE reg_id = {}").format(reg_id)
m.execute(q8)
conn.commit()
print("----------------------------------------------------------------------------
---------------------")
print("----------------------------Your registration is delete
now!!!-----------------------------------")
print("----------------------------------------------------------------------------
-----------------")
print("---------------------------- DONE.... THANK YOUU!!!
-----------------------------------")
def update_payment_status(reg_id,instl_I_pay,instl_II_pay,instl_III_pay ):
q10 = "UPDATE reg_details SET instl_I_pay = '{}', instl_II_pay = '{}',
instl_III_pay= '{}' WHERE reg_id =
{}".format(instl_I_pay,instl_II_pay,instl_III_pay,reg_id)
m.execute(q10)
conn.commit()
print("----------------------------------------------------------------------------
-----------------")
print("---------------------------- DONE.... THANK YOUU!!!
-----------------------------------")
def delete_faculty(fac_id):
q11 = "DELETE FROM fac_info WHERE fac_id = {}".format(fac_id)
m.execute(q11)
conn.commit()
print("----------------------------------------------------------------------------
-----------------")
print("---------------------------- DONE.... THANK YOUU!!!
-----------------------------------")
def view_student_details(stud_id):
q12 = "SELECT * FROM stud_info WHERE stud_id = {}".format(stud_id)
m.execute(q12)
result = m.fetchone()
if result:
print("Student Details:", result)
else:
print("Student not found.")
conn.commit()
print("----------------------------------------------------------------------------
-------------------")
print("----------------------------- DONE.... THANK YOUU!!!
------------------------------------")
def view_faculty_details(fac_id):
q14="SELECT * FROM fac_info WHERE fac_id={}".format(fac_id)
m.execute(q14)
result = m.fetchone()
if result:
print("Faculty Details: ",result)
else:
print("NOT FOUND..")
print("----------------------------------------------------------------------------
-------")
print("------------------------ DONE.... THANK YOUU!!!
-----------------------------")
login()