-
Notifications
You must be signed in to change notification settings - Fork 0
/
prog5_inheritance1.py
73 lines (62 loc) · 2.01 KB
/
prog5_inheritance1.py
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
73
class STUDENT:
def __init__(self):
self.usn = ""
self.name=""
self.age=""
def getdata(self):
self.usn = int(input("Enter your USN Number : "))
self.name = input("Enter your Name :")
self.age = int(input("Enter your age :"))
class UGSTUDENT(STUDENT):
def __init__(self):
self.sem = ""
self.fees=""
self.stipend=""
def getugdata(self):
self.sem = int(input("Enter your semester : "))
self.fees = int(input("Enter your college fees :"))
self.stipend = int(input("Enter your stipend :"))
def display_ug(self):
print("Your Name is :",self.name)
print("\nYour USN is :",self.usn)
print("\nYour Age is :",self.age)
print("\nYour Semester is :",self.sem)
print("\nYour College Fee is :",self.fees)
print("\nYour stipend is :",self.stipend)
class PGSTUDENT(STUDENT):
def __init__(self):
self.sem = ""
self.fees=""
self.stipend=""
def getpgdata(self):
self.sem = int(input("Enter your semester : "))
self.fees = int(input("Enter your college fees :"))
self.stipend = int(input("Enter your stipend :"))
def display_pg(self):
print("Your Name is :",self.name)
print("\nYour USN is :",self.usn)
print("\nYour Age is :",self.age)
print("\nYour Semester is :",self.sem)
print("\nYour College Fee is :",self.fees)
print("\nYour stipend is :",self.stipend)
SU=STUDENT()
PG=PGSTUDENT()
UG=UGSTUDENT()
while True:
print("\n-----------------------------------------------------------------------------------------------------------------------------")
print("select one option")
print("1. Enter UG Student Details \n2. Enter PG Student Details\n3. Print UG Student Details\n4. Print PG Student Details\n5. Exit")
ch = int(input("Enter your choice :"))
if ch==1:
UG.getdata()
UG.getugdata()
if ch==2:
PG.getdata()
PG.getpgdata()
if ch==3:
UG.display_ug()
if ch==4:
PG.display_pg()
if ch==5:
break
print("\n-----------------------------------------------------------------------------------------------------------------------------")