Question: 2 . 9 LAB: Course information ( derived classes ) Define a Course base class with the following attributes: number - course number title -

2.9 LAB: Course information (derived classes)
Define a Course base class with the following attributes:
number - course number
title - course title
Define a print_info() method in Course that displays the course number and title.
Also define a derived class OfferedCourse with the additional attributes:
instructor_name - instructor name
location - class location
class_time - class time
Ex: If the input is:
ECE287
Digital Systems Design
ECE387
Embedded Systems Design
Mark Patterson
Wilson Hall 231
WF: 2-3:30 pm class Course:
# TODO: Define constructor with attributes
# TODO: Define print_info()
class OfferedCourse(Course):
# TODO: Define constructor with attributes
if __name__=="__main__":
course_number = input()
course_title = input()
o_course_number = input()
o_course_title = input()
instructor_name = input()
location = input()
class_time = input()
my_course = Course(course_number, course_title)
my_course.print_info()
my_offered_course = OfferedCourse(o_course_number, o_course_title, instructor_name, location, class_time)
my_offered_course.print_info()
print(f' Instructor Name: { my_offered_course.instructor_name }')
print(f' Location: { my_offered_course.location }')
print(f' Class Time: { my_offered_course.class_time }')

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!