Question: URGENT - need it in 45 min. Use Python to: 1. a) Create a superclass called Course to represent a university course containing attributes for

URGENT - need it in 45 min. Use Python to: 1. a) Create a superclass called Course to represent a university course containing attributes for course title and course ID number. Provide accessor methods for each attribute. Include a display method to output the course information in the following format: Title: Introduction to Programming ID: 83713 b) Create a class called OfferedCourse that is a subclass of the Course class and includes the additional attribute of a list of IDs of students enrolled. Provide a method to return the number of students enrolled in the course. Include a method called addStudent to add a student to the course, provided the student is not already registered, as well as a corresponding dropStudent method (provided the student is registered). Also include a display function that overrides the Course display function to output the course information in the following format: Title: Introduction to Programming ID: 83713 Enrolment: 56 Note that the display method in the OfferedCourse class should call the display method of its superclass. c) Create a StudentCourse class that is a subclass of the Course class and includes the additional attribute of grade. Provide an accessor method for grade. Include a display function that overrides the Course display function to output the course information in the following format: Title: Introduction to Programming ID: 83713 Grade: 88 Note that the display method in the StudentCourse class should call the display method of its superclass. d) Write a main function to create instances of each class created above and call the display method on each object created. 2. Import your courses module created in Question 1 to perform the following:

a) Ask the user for the name of a file containing course information (course name, ID number, and grade) for a given student in the following format:

Introduction to Programming, 1001, 88 Data analysis, 2500, 76 Introduction to Computer Science, 1000, 90 ... 

b) Open the file (after checking that the file exists)

c) Read the information for each course and create a list of StudentCourses (reading to the end of the file)

d) Write a function that takes a list of StudentCourses as an argument and returns the student's average

e) Call your average function to compute and display the average for the student whose course information you read from the user-supplied file

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!