Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Michael V. Mannino

3rd Edition

0071107010, 978-0071107013

More Books

Students also viewed these Databases questions

Question

What is job rotation ?

Answered: 1 week ago