Question: programming 5 1 1 python: Question 1 ( 2 5 marks ) 1 . Explain how the following set operations work: ( 7 marks )
programming python:
Question marks
Explain how the following set operations work: marks
a Union
b Intersection
c Difference
Discuss the four characteristics of ObjectOriented Programming. marks
Define the following terms: marks
a Database
b Record
c Field
d Primary Key
e Foreign Key
Question marks
Implement a University Course Management System using ObjectOriented Programming
principles in Python. The system should manage courses, students, and professors. Create the
following classes with their respective attributes and methods:
a Create a Person class with name, age, and ID attributes. Implement an init method to initialise
these attributes and a str method to return a string representation of a Person object.
b Develop a Student class that inherits from the Person class. In addition to the inherited
attributes, include a major and a list of enrolledcourses. Implement an enrolcourse method
that adds a course to the student's enrolledcourses if there's capacity in the course. Also,
create a dropcourse method that removes a course from the student's enrolledcourses.
c Create a Professor class that inherits from the Person class. Add attributes for the department
and a list of coursesteaching. Implement an assigncoursecourse method that adds a
course to the professor's coursesteaching list and sets the course's professor attribute to this
professor.
d Design a Course class with attributes for coursecode, name, maxcapacity, professor, and a
list of enrolledstudents. Implement init and str methods, addstudentstudent and
removestudentstudent methods. The addstudent method should add a student to the
course if there's capacity, while the removestudent method should remove a student from
the course.
e Develop a University class with attributes for names and lists of courses, students, and
professors. Implement methods to addcoursecourse addstudentstudent and
addprofessorprofessor to their respective lists. Also, create a getcoursecoursecode
method that returns a course given its course code.
Create a demo script that instantiates the University class and populates it with courses, students,
and professors. Demonstrate the functionality by enrolling students in courses, assigning
professors to courses, dropping students from courses, and printing out the state of courses,
students, and professors after these operations
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
