Repository navigation
Expand file tree
/
Copy pathstudent_profile
More file actions
72 lines (58 loc) · 1.98 KB
/
Copy pathstudent_profile
File metadata and controls
72 lines (58 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
class Student:
TOTAL_FEE = 90000
def __init__(self, sid, name, m1, m2, m3, birth_year, fee_paid):
self.sid = sid
self.name = name
self.m1 = m1
self.m2 = m2
self.m3 = m3
self.birth_year = birth_year
self.fee_paid = fee_paid
def calculate_average(self):
avg = (self.m1 + self.m2 + self.m3) / 3
print("Average Marks:", avg)
def calculate_cgpa(self):
avg = (self.m1 + self.m2 + self.m3) / 3
cgpa=avg/10
print("CGPA:", cgpa)
def calculate_age(self):
age=2026-self.birth_year
print("Age:", age)
def fee_balance(self):
balance=Student.TOTAL_FEE-self.fee_paid
print("Fee Balance:", balance)
def display_student(self):
print("Student ID:", self.sid)
print("Name:", self.name)
print("Marks:", self.m1, self.m2, self.m3)
print("Fee Paid:", self.fee_paid)
self.calculate_average()
self.calculate_cgpa()
self.calculate_age()
self.fee_balance()
print("------------------------")
class College:
def __init__(self, code, name, location):
self.code = code
self.name = name
self.location = location
self.students = []
def register_student(self, student):
self.students.append(student)
def display_details(self):
print("College Code:", self.code)
print("College Name:", self.name)
print("Location:", self.location)
print("\n student Academic Report")
print("===========================")
for s in self.students:
s.display_student()
# Main Program
college = College("ANIL", "ANITS College", "Visakhapatnam")
s1 = Student(14, "Suhas", 92, 96, 98, 2007, 60000)
s2 = Student(7, "Ramya", 93, 96, 90, 2007, 40000)
s3 = Student(23, "Navadeep", 80, 85, 78, 2006, 70000)
college.register_student(s1)
college.register_student(s2)
college.register_student(s3)
college.display_details()