Source Code in Python
Source Code in Python
"""
COMPUTER SCIENCE PROJECT
"REPORT CARD MANAGEMENT SYSTEM"
SUBMITTED BY :- MRIGANK YASHVARDHAN
CLASS :- XII A2
"""
#**********************************************************************************
#**********************************************************************************
#**********************************************************************************
# 2. Defining the ADD_STUDENT FUNCTION (Add the students details to the existing
database)
def add_student():
# Establishing a connection to the database
conn = mysql.connector.connect(
host='localhost',
database='report_card',
user='root',
password='kalpit369'
)
#----------------------------------------------------------------------------------
sql = 'insert into marks (admno, term, session, phy, chem, math, eng, comp)
values ("'+admno+'", "'+term+'", "'+session+'", \
"'+phy+'", "'+chem+'", "'+math+'", "'+eng+'", "'+comp+'");'
cursor.execute(sql)
#**********************************************************************************
**********************************************************
def modify_student():
#**********************************************************************************
def modify_marks():
#**********************************************************************************
# 6. Defining the search_student function with parameter field :seach existing
student record in database
def search_student(field):
if field == 'admno':
sql = sql + field + '=' +value+ ';'
else:
sql = sql + field + ' like "%' +value+ '%" or fname like "%' +value+ '%";'
cursor.execute(sql)
records = cursor.fetchall()
#**********************************************************************************
# 7. Defining the search_marks function : Extract the marks from the records of the
def search_marks():
print('Search Result for Admission No. : ' +admno+ 'Session : ' '+session')
cursor.execute(sql)
records = cursor.fetchall()
#**********************************************************************************
#**********************************************************************************
print('_'*120)
total = record[3] + record[4]+ record[5]+ record[6]+ record[7]
percentage = total * 100 / 500
print('Total Marks : ', total, '% Marks : ', percentage )
#**********************************************************************************
# 10. Defining the report_whole_class function: To display the entire class record
def report_whole_class():
print('Class Wise Report Card :', clas, '-', section, 'Session : ', session,
'Term : ', term)
print('-'*120)
#**********************************************************************************
for idr, name, fname, clas1, section, term, phy, chem, math, eng, comp in
records:
total = phy+chem+math+eng+comp
t.add_row([idr, name, fname, clas1, section, term, phy, chem, math, eng,
comp, total])
print(t)
#**********************************************************************************
# 12. Defining report_topper_list function: Display the student records who secure
topmost postion
def report_topper_list():
for idr, name, fname, phy, chem, math, eng, comp, total in records:
t.add_row(idr, name, fname, phy, chem, math, eng, comp, total)
print(t)
#**********************************************************************************
# 13. Defining report_menu function: Give access the user to display desired record
def report_menu():
while True:
#**********************************************************************************
# 14. Defining the main_menu function : Prompt the user to access/update the
database.
def main_menu():
while True:
#Printing the screen datails of the function so that user see which option
to choose
print(' R E P O R T C A R D M E N U ')
print("\n1. Add Student")
print("\n2. Modify Students")
print("\n3. Add Marks")
print("\n4. Modify Menu")
print("\n5. Search Menu")
print("\n6. Report Menu")
print('\n7. Close Application')
print('\n\n')
#**********************************************************************************