0% found this document useful (0 votes)
3 views5 pages

Object-Oriented Programming Course Code

The document describes a Python program that models a university with degrees, subjects, and students using object-oriented programming. It defines classes Degree, Subject, and Student with their attributes and methods. The program allows entering, modifying, and querying data of students from different subjects.

Translated by

ScribdTranslations
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views5 pages

Object-Oriented Programming Course Code

The document describes a Python program that models a university with degrees, subjects, and students using object-oriented programming. It defines classes Degree, Subject, and Student with their attributes and methods. The program allows entering, modifying, and querying data of students from different subjects.

Translated by

ScribdTranslations
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

University of the Armed Forces ESPE Latacunga Extension

Department of Electrical and Electronics


Object-Oriented Programming
Karla Altamirano
Course: 2° 'B'
Degree: Software Engineering
classCareer():
def __init__(self, name, code):
name
[Link]=codigo
[Link]={}
def addSubject(self, subject):
[Link][[Link]]=materia
classSubject():
def __init__(self, name, NRC, career):
name
[Link]=nrc
career
[Link]={}
def addStudent(self, student):
[Link][[Link]] = student
classStudent():
def __init__(self, name, id, subject, par1, par2, par3, average):
name
iden
[Link]=materia
self.par1=par1
self.par2=par2
par3
[Link]=prom
def showdata(self):
STUDENT DATA
print("Name: {}").format([Link])
print("ID: {}".format([Link]))
Subject: {}
Print("Partial 1: {}".format(self.par1))
Partial 2: {}
Partial 3: {}
Average: {}

defmain():
civil=Carrera("Ingenieria Civil","CIV001")
Soil Mechanics
[Link](mecds)
Career("Software Engineering","ISOW203")
poo=Materia("Programacion orientada a objetos","3922",software)
[Link](poo)
1
1
while(opmenu != 5):
University of the Armed Forces ESPE
1. Enter student.
2. Unsubscribe.
3. Enter/Modify student grades.
4. Consult student data.
5. Exit.
Enter the option:
1
while(opmat!=3):
Choose a subject:
1. Object-oriented programming
2. Soil Mechanics
3. Exit
opmat=int(input())
ifopmat==1:
Object-Oriented Programming
ne=int(input("Enter number of students: "))
ifne<=8:
foriinrange (ne):
Enter the student's data
name=input('Name: ')
idd=input("ID: ")
Student(name, id, grade, 0, 0, 0, 0)
[Link](alum1)
else:
No more than 8 students per course.
elifopmat==2:
Soil Mechanics
ne2=int(input("Enter number of students: "))
ifne2<=8:
forbinrange (ne2):
Enter the student's data
name2=input("Name: ")
input("ID: ")
Student(nom2, idd2, mecds, 0, 0, 0, 0)
[Link](alum2)
else:
No more than 8 students per course.
else:
break
elifopmenu==2:
Unsubscribe
mt=int(input("Enter the subject 1. OOP 2. MECDS: "))
if(mt==1):
print("Student list - ", [Link])
[Link]():
print([Link], "-", [Link])
Enter the ID to continue:
[Link]=input()
[Link]([Link])
Student removed
elifmt==2:
Student list -
[Link]():
print([Link], "-", [Link])
Enter the ID to continue:
[Link]=input()
[Link]([Link])
Student deleted
else:
This subject does not exist
elifopmenu==3:
Input/Modification of grades
opmt=1
while(opmt!=3):
Choose a subject:
1. Object-oriented programming
2. Soil Mechanics
3. Exit
opmt=int(input())
ifopmt==1:
im=1
while(im!=3):
1. Entry // 2. Modification // 3.
Leave: ))
ifim==1:
The provided text does not contain translatable content.
print([Link])
Enter the grades:
ll.par1=float(input("Partial 1: "))
Partial 2:
ll.par3=float(input("Partial 3: "))
[Link]=((ll.par1+ll.par2+ll.par3)/3)
Average:
if([Link]<14):
Failed
else:
Approved
elifim==2:
[Link]():
print([Link], "-", [Link])
Enter the ID to continue:
ivo=input()
ifivo==[Link]:
Modify the grades:
Print("Partial 1: ", pn.par1)
New partial 1:
Partial 2:
pn.par2=float(input("New Partial 2: "))
Print("Partial 3: ", pn.par3)
float(input("New Partial 3: "))
((pn.par1 + pn.par2 + pn.par3) / 3)
Average:
if([Link]<14):
Failed
else:
Approved
elifivo!=[Link]:
This student does not exist
else:
break
else:
break
elifopmt==2:
mm=1
while(mm!=3):
1. Entry // 2. Modification // 3.
Exit: ))
ifmm==1:
[Link]():
print([Link])
Enter the grades:
Partial 1:
Partial 2:
Partial 3:
[Link]=((pp.par1+pp.par2+pp.par3)/3)
Average:
if([Link]<14):
Failed
else:
Approved
elifmm==2:
[Link]():
print([Link], "-", [Link])
Enter the ID to continue:
ido=input()
ifido==[Link]:
Modify the grades:
Partial 1:
Partial 1 new:
Partial 2:
float(input("New Partial 2: "))
Partial 3:
New Partial 3:
[Link]=((nn.par1+nn.par2+nn.par3)/3)
print("Average: ", [Link])
if([Link]<14):
Failed
else:
Approved
elifido != [Link]:
This student does not exist
else:
break
else:
break
else:
break
elifopmenu==4:
Data Inquiry
1
while(opd!=3):
Choose a subject:
1. Object-oriented programming
2. Soil Mechanics
3. Exit
opd=int(input())
ifopd==1:
Object-oriented programming:
[Link]():
print([Link], '-', [Link], '-', [Link])
elifopd==2:
Soil Mechanics:
[Link]():
print([Link], " - ", [Link], " - ", [Link])
elifopmenu==5:
Thank you for using our services.
break
else:
This option does not exist

if __name__ == '__main__':
main()

You might also like