Instance Attributes and Properties Protect the data to ensure encapsulation. Implement properties for al instance attributes unless noted.
Instance Attributes and Properties Protect the data to ensure encapsulation. Implement properties for al instance attributes unless noted.
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
Implement the class below in python3
- Instance Attributes and Properties
- Protect the data to ensure encapsulation.
- Implement properties for al instance attributes unless noted.
![University
- name : string
str
+ add_undergrad(name, email, gpa)
+ add_graduate(name, email, level)
+ add_course(.)
+ remove_student(name) : list
+ get_students(name, id, email) : list
+ get_courses(subject, number, title): list
+ enroll_student( id, subject, number)
+ enrollment_report(): dict](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F1d722143-f111-402d-9194-370f4c36bfd7%2F1abdc57b-20be-4032-be49-9338f09ca682%2F9spyuxk_processed.png&w=3840&q=75)
Transcribed Image Text:University
- name : string
str
+ add_undergrad(name, email, gpa)
+ add_graduate(name, email, level)
+ add_course(.)
+ remove_student(name) : list
+ get_students(name, id, email) : list
+ get_courses(subject, number, title): list
+ enroll_student( id, subject, number)
+ enrollment_report(): dict
![• University:
• Represent the university which has students and courses.
• All properties are read only. Student and course lists cannot be retrieved by the clients.
• The university is responsible of creating the objects:
- add_undergrad(name, email, gpa) and add_graduate(name, email, level) methods will create and add students to the university. Student's id will be generated automatically on
the Student constructor. The data such as valid GPA values or valid Level value will be validated properly in each class properties methods.
· add_course(subject, number, title) will add a course. Will raise a ValueError exception if there is already a course with the same subject and number.
• get_students and get_courses
• will take optionaly any of the arguments and return a list of the objects students or courses respectively, that matches the search criteria.
· String-based attributes are not exact match but rather that the data contain that search string.
· e.g. get_students(email="john.doe") will return a list of students which emails have "john.doe" in it, such as "john.doe.smith@." "william.john.doe@.", etc.
· Clarification: objects (students/courses) should match all specified filters by the user. E.g. get_courses("CSCI", 3920) will return all courses that match both the subject and
number.
· Hint: use default arguments and lists and sets to make your code simple. Consider having a matching list per filter and then compute the intersection; initialization will be
critical for this to work.
• enroll_student(.) will take the student's id and the course's subject and number and will enroll the student to the course. Enrollment is kept at the student as a list of courses the
student is enrolled to.
• enrollment_report() will return a dictionary of the form key -> value, where key is a string representing the course (concatenation of subject and number - formatted in 4 digit with
leading zeros), and the value is a list of students enrolled to that course.
· e.g. "CSCI3920" -> [ stu1, stu2,..]
· Clarification: Only courses with enrolled students will appear in the result.
• remove_student(name) removes all the students that has that name, comparing with exact match but ignoring case. Will return the list of students removed (may be empty).](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F1d722143-f111-402d-9194-370f4c36bfd7%2F1abdc57b-20be-4032-be49-9338f09ca682%2F6gcvilh_processed.png&w=3840&q=75)
Transcribed Image Text:• University:
• Represent the university which has students and courses.
• All properties are read only. Student and course lists cannot be retrieved by the clients.
• The university is responsible of creating the objects:
- add_undergrad(name, email, gpa) and add_graduate(name, email, level) methods will create and add students to the university. Student's id will be generated automatically on
the Student constructor. The data such as valid GPA values or valid Level value will be validated properly in each class properties methods.
· add_course(subject, number, title) will add a course. Will raise a ValueError exception if there is already a course with the same subject and number.
• get_students and get_courses
• will take optionaly any of the arguments and return a list of the objects students or courses respectively, that matches the search criteria.
· String-based attributes are not exact match but rather that the data contain that search string.
· e.g. get_students(email="john.doe") will return a list of students which emails have "john.doe" in it, such as "john.doe.smith@." "william.john.doe@.", etc.
· Clarification: objects (students/courses) should match all specified filters by the user. E.g. get_courses("CSCI", 3920) will return all courses that match both the subject and
number.
· Hint: use default arguments and lists and sets to make your code simple. Consider having a matching list per filter and then compute the intersection; initialization will be
critical for this to work.
• enroll_student(.) will take the student's id and the course's subject and number and will enroll the student to the course. Enrollment is kept at the student as a list of courses the
student is enrolled to.
• enrollment_report() will return a dictionary of the form key -> value, where key is a string representing the course (concatenation of subject and number - formatted in 4 digit with
leading zeros), and the value is a list of students enrolled to that course.
· e.g. "CSCI3920" -> [ stu1, stu2,..]
· Clarification: Only courses with enrolled students will appear in the result.
• remove_student(name) removes all the students that has that name, comparing with exact match but ignoring case. Will return the list of students removed (may be empty).
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Recommended textbooks for you
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY