Computer Science Project1
Computer Science Project1
PYTHON
CLASS: XII B
PROJECT CODE:
def getd(self):
self.name=input("Enter name :")
print()
self.rno=int(input("Enter rno"))
print()
self.marks[0]=float(input("Enter English
marks :"))
self.marks[1]=float(input("Enter Math
marks :"))
self.marks[2]=float(input("Enter Physics
marks :"))
self.marks[3]=float(input("Enter
Chemistry marks :"))
self.marks[4]=float(input("Enter
Computer Science :"))
print()
self.sum=sum(self.marks)
self.per=self.sum/5
def dispd(self):
print("Roll No. :",self.rno)
print("Name :",self.name)
print()
print("+++++++++++++++++++++++++")
print("+English Marks:
+",self.marks[0])
print("+Math Marks:
+",self.marks[1])
print("+Physics Marks:
+",self.marks[2])
print("+Chemistry Marks:
+",self.marks[3])
print("+Computer Science
Marks:+",self.marks[4])
print("+++++++++++++++++++++++++")
print()
print("Overall Average is :",self.per)
def add():
a1=studentclass()
fp=open("d:\\classreportproject.dat","a+b")
a1.getd()
dump(a1,fp)
fp.flush()
fp.close()
def modi():
en=int(input("Enter rno of the object you
desire to change :"))
fp=open("d:\\classreportproject.dat","rb")
fp1=open("d:\\temp.dat","wb")
c=0
try:
while True:
a2=load(fp)
if a2.rno==en:
c=1
a2.getd()
dump(a2,fp1)
fp1.flush()
else:
dump(a2,fp1)
fp1.flush()
except EOFError:
pass
fp.close()
fp1.close()
from os import remove,rename
remove("d:\\classreportproject.dat")
rename("d:\\temp.dat","d:\\classreportproj
ect.dat")
if c==1:
print("RECORD MODIFIED.........")
else:
print("Record with given rno doesn't
exist")
def count():
fp=open("d:\\classreportproject.dat","rb")
passed=0
failed=0
try:
print()
while True:
a2=studentclass()
a2=load(fp)
if a2.per>=33:
passed+=1
else:
failed+=1
except EOFError:
pass
print("Number of students that
passed:",passed)
print()
print("Number of students that
failed:",failed)
fp.close()
def disprec():
fp=open("d:\\classreportproject.dat","rb")
try:
print()
print("NAME\t\tRNO\t\tMARKS")
while True:
a2=load(fp)
a2.dispd()
except EOFError:
print("END OF FILE.........")
fp.close()
def delrec():
en=int(input("Enter rno of the object you
desire to delete :"))
fp=open("d:\\classreportproject.dat","rb")
fp1=open("d:\\temp.dat","wb")
c=0
try:
while True:
a2=studentclass()
a2=load(fp)
if a2.rno==en:
c=1
fp1.flush()
pass
else:
dump(a2,fp1)
fp1.flush()
except EOFError:
pass
fp.close()
fp1.close()
from os import remove,rename
remove("d:\\classreportproject.dat")
rename("d:\\temp.dat","d:\\classreportproj
ect.dat")
if c==1:
print("<<<<<<<<<<<<<<RECORD
DELETED>>>>>>>>>>>>>>>>")
else:
print(" SORRY GIVEN ROLL NO.
RECORD DOES NOT EXIST !!!!!!!!")
def search():
print()
en=int(input("Enter rno of the object you
desire to view :"))
fp=open("d:\\classreportproject.dat","rb")
c=0
try:
while True:
a2=studentclass()
a2=load(fp)
if a2.rno==en:
c=1
a2.dispd()
if a2.per>=33:
print("RESULT: PASSED")
else:
print("RESULT\: FAILED")
pass
except EOFError:
pass
if c!=1:
print("Record does not exist")
print()
fp.close()
def subj():
print()
print("L I S T OF S U B J E C T S ")
print("+++++++++++++++")
print("+1. English +")
print("+2. Math +")
print("+3. Physics +")
print("+4. Chemistry +")
print("+++++++++++++++")
print()
x=int(input("Enter the Number of the
Subject you wish to view."))-1
s=[]
fp=open("d:\\classreportproject.dat","rb")
c=0
try:
while True:
a2=studentclass()
a2=load(fp)
s.append(a2.marks[x])
except EOFError:
pass
fp.close()
print()
print("Maximum marks:",max(s))
print("Minimum marks:",min(s))
print("Average of the
Class:",sum(s)/len(s))
# FILE MANAGEMENT
def filemanagementmenu():
choi=0
while choi!=6:
print()
print("\tF I L E M A N A G E M E N T")
print()
print("+++++++++++++++++++++++")
print("+1. Add Record +")
print("+2. Search for Record +")
print("+3. Modify Record +")
print("+4. Delete Record +")
print("+5. View All Records +")
print("+6. Quit +")
print("+++++++++++++++++++++++")
print()
choi=int(input("Enter your choice"))
print()
if choi==1:
add()
elif choi==2:
search()
elif choi==3:
modi()
elif choi==4:
delrec()
elif choi==5:
disprec()
# STUDENT REPORT
def STUDENTRECORD():
choi=0
while choi!=4:
print()
print()
print("\tS T U D E N T R E P O R T")
print()
print("++++++++++++++++++++++++++++++
+")
print("+1. Class Report +")
print("+2. Individual Student Report +")
print("+3. Subjectwise Report +")
print("+4. Quit +")
print("++++++++++++++++++++++++++++++
+")
print()
choi=int(input("ENTER YOUR CHOICE
:"))
print()
if choi==1:
count()
elif choi==2:
search()
elif choi==3:
subj()
# MAIN PROGRAM
ch=0
while ch!=3:
print()
print("++++++++++++++++++++++++++++++
+++++++++++++++++")
print("+ S T U D E N T R E P O R T S Y S
T E M +")
print("+ +")
print("+ 1. F I L E M A N A G E M E N T
+")
print("+ 2. S T U D E N T R E P O R T
+")
print("+ 3. E X I T +")
print("++++++++++++++++++++++++++++++
+++++++++++++++++")
print()
ch=int(input("E N T E R Y O U R C H O I
C E :"))
if(ch==1):
filemanagementmenu()
elif ch==2:
STUDENTRECORD()
elif ch==3:
print("THANK YOU FOR USING OUR
REPORT SYSTEM....")
print("HAVE A NICE DAY!!!")
else:
print("Sorry! CHOICES POSSIBLE(1-3)")
OUTPUT:
======== RESTART:
C:\Users\Student\Downloads\StudentRepor
tProject2.py ========
++++++++++++++++++++++++++++++++++++
+++++++++++
+ STUDENT REPORT SYSTEM+
+ +
+ 1. F I L E M A N A G E M E N T +
+ 2. S T U D E N T R E P O R T +
+ 3. E X I T +
++++++++++++++++++++++++++++++++++++
+++++++++++
E N T E R Y O U R C H O I C E :1
FILE MANAGEMENT
+++++++++++++++++++++++
+1. Add Record +
+2. Search for Record +
+3. Modify Record +
+4. Delete Record +
+5. View All Records +
+6. Quit +
+++++++++++++++++++++++
Enter rno1
+++++++++++++++++++++++
+1. Add Record +
+2. Search for Record +
+3. Modify Record +
+4. Delete Record +
+5. View All Records +
+6. Quit +
+++++++++++++++++++++++
FILE MANAGEMENT
+++++++++++++++++++++++
+1. Add Record +
+2. Search for Record +
+3. Modify Record +
+4. Delete Record +
+5. View All Records +
+6. Quit +
+++++++++++++++++++++++
Enter rno2
RECORD MODIFIED.........
FILE MANAGEMENT
+++++++++++++++++++++++
+1. Add Record +
+2. Search for Record +
+3. Modify Record +
+4. Delete Record +
+5. View All Records +
+6. Quit +
+++++++++++++++++++++++
FILE MANAGEMENT
+++++++++++++++++++++++
+1. Add Record +
+2. Search for Record +
+3. Modify Record +
+4. Delete Record +
+5. View All Records +
+6. Quit +
+++++++++++++++++++++++
+++++++++++++++++++++++++
+English Marks: + 100.0
+Math Marks: + 100.0
+Physics Marks: + 100.0
+Chemistry Marks: + 100.0
+Computer Science Marks:+ 99.0
+++++++++++++++++++++++++
FILE MANAGEMENT
+++++++++++++++++++++++
+1. Add Record +
+2. Search for Record +
+3. Modify Record +
+4. Delete Record +
+5. View All Records +
+6. Quit +
+++++++++++++++++++++++
Enter rno2
+++++++++++++++++++++++
+1. Add Record +
+2. Search for Record +
+3. Modify Record +
+4. Delete Record +
+5. View All Records +
+6. Quit +
+++++++++++++++++++++++
+++++++++++++++++++++++++
+English Marks: + 100.0
+Math Marks: + 100.0
+Physics Marks: + 100.0
+Chemistry Marks: + 100.0
+Computer Science Marks:+ 99.0
+++++++++++++++++++++++++
+++++++++++++++++++++++++
+English Marks: + 12.0
+Math Marks: + 13.0
+Physics Marks: + 14.0
+Chemistry Marks: + 15.0
+Computer Science Marks:+ 16.0
+++++++++++++++++++++++++
FILE MANAGEMENT
+++++++++++++++++++++++
+1. Add Record +
+2. Search for Record +
+3. Modify Record +
+4. Delete Record +
+5. View All Records +
+6. Quit +
+++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++
+++++++++++
+ STUDENT REPORT SYSTEM+
+ +
+ 1. F I L E M A N A G E M E N T +
+ 2. S T U D E N T R E P O R T +
+ 3. E X I T +
++++++++++++++++++++++++++++++++++++
+++++++++++
E N T E R Y O U R C H O I C E :2
STUDENT REPORT
+++++++++++++++++++++++++++++++
+1. Class Report +
+2. Individual Student Report +
+3. Subjectwise Report +
+4. Quit +
+++++++++++++++++++++++++++++++
STUDENT REPORT
+++++++++++++++++++++++++++++++
+1. Class Report +
+2. Individual Student Report +
+3. Subjectwise Report +
+4. Quit +
+++++++++++++++++++++++++++++++
+++++++++++++++++++++++++
+English Marks: + 100.0
+Math Marks: + 100.0
+Physics Marks: + 100.0
+Chemistry Marks: + 100.0
+Computer Science Marks:+ 99.0
+++++++++++++++++++++++++
STUDENT REPORT
+++++++++++++++++++++++++++++++
+1. Class Report +
+2. Individual Student Report +
+3. Subjectwise Report +
+4. Quit +
+++++++++++++++++++++++++++++++
LIST OF SUBJECTS
+++++++++++++++
+1. English +
+2. Math +
+3. Physics +
+4. Chemistry +
+++++++++++++++
Enter the Number of the Subject you wish
to view.1
STUDENT REPORT
+++++++++++++++++++++++++++++++
+1. Class Report +
+2. Individual Student Report +
+3. Subjectwise Report +
+4. Quit +
+++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++
+++++++++++
+ STUDENT REPORT SYSTEM+
+ +
+ 1. F I L E M A N A G E M E N T +
+ 2. S T U D E N T R E P O R T +
+ 3. E X I T +
++++++++++++++++++++++++++++++++++++
+++++++++++
E N T E R Y O U R C H O I C E :3
THANK YOU FOR USING OUR REPORT
SYSTEM....
HAVE A NICE DAY!!!