1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
konstantin123 [22]
3 years ago
14

Define a Course base class with attributes number and title. Define a print_info() method that displays the course number and ti

tle.
Also define a derived class OfferedCourse with the additional attributes instructor_name, term, and class_time.
Ex: If the input is:
ECE287
Digital Systems Design
ECE387
Embedded Systems Design
Mark Patterson
Fall 2018
WF: 2-3:30 pm
the output is:
Course Information:
Course Number: ECE287
Course Title: Digital Systems Design
Course Information:
Course Number: ECE387
Course Title: Embedded Systems Design
Instructor Name: Mark Patterson
Term: Fall 2018 Class
Time: WF: 2-3:30 pm

Computers and Technology
1 answer:
lesya [120]3 years ago
7 0

Answer:

Here is the Python program:

class Course:

   def __init__(self,number, title):

       self.number = number

       self.title = title

   def print_info(self):

       print("Course Information:")  

       print("Course Number:", self.number)

       print("Course Title:", self.title)

class OfferedCourse(Course):

   def __init__(self, number, title,instructor_name,term,class_time):

       self.number = number

       self.title = title

       self.instructor_name = instructor_name

       self.term = term

       self.class_time=class_time

if __name__ == "__main__":

   course_number = input()

   course_title = input()

   o_course_number = input()

   o_course_title = input()

   instructor_name = input()

   term = 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, term, class_time)

   my_offered_course.print_info()

   print('Instructor Name:', my_offered_course.instructor_name)

   print('Term:', my_offered_course.term)

   print('Class Time:', my_offered_course.class_time)

Explanation:

Course is a base class with attributes number and title. It has a print_info() method that displays the course number and title.

self keyword is the keyword which is used to easily access all the instances defined within a Course class, including its method and attributes number and title.

__init__ is a constructor which is called when an instance is created from the Course, and access is required to initialize the attributes number and title of Course class.

OfferedCourse is a class which is derived from base class Course. In addition to attributes number and title, it has attributes attributes instructor_name, term, and class_time.

A special attribute __name__. The value of __name__ attribute is set to “__main__” in order to run this module as a main program. In this main program input() method is used to take input from user. The input is the course number, title, instructor name, term and class time. The object my_course of Course class is created and the constructor of Course class is called passing the course_number and course_title using this object to access the attributes (member variables number and term) of the Course class. Next the instance my_course is used to call function print_info() of Course class.

The object my_offered_course of OfferedCourse class is created and the constructor of OfferedCourse class is called passing the o_course_number, o_course_title, instructor_name, term, class_time using this object to access the attributes number, title, instructor_name,term, class_time OfferedCourse class. Next the instance my_offered_course is used to call function print_info() of Course class. Here it is to be noticed that the derived class OfferedCourse uses the method print_info() of its base class Course. Last three print statements of the main program use object my_offered_course to access the attributes  instructor_name, term and class_time of class OfferedCourse to display the their values.

The screenshot of the program output is attached.

You might be interested in
What education and training is required to be an applications software engineer?
Vitek1552 [10]
Expertise in Computer Science/ Computer Programming Tools. C, C++, Java Visual Basic , Android or iphone. BS Software Engineering
7 0
4 years ago
_____ should be used to create a project schedule.
dem82 [27]

Answer:

meeting is the correct answer

3 0
3 years ago
Simplify this question 3(4)(10)
enyata [817]
You are going to multiply 4 three times and 10 three times. I hope this helps
7 0
3 years ago
TCP and the User Datagram Protocol (UDP) provide _________ between processes on any two of those hosts. A. address translation B
Fynjy0 [20]

TCP is known to be a type of a connection-oriented protocol, while UDP is a connectionless protocol. TCP and UDP provide data transport between hosts.

  • TCP and UDP are known for their speed, as TCP is slower and can retransmit lost data packets than UDP. UDP is said to be faster, simpler, and efficient protocol.

Data transport is simply known to be an the energy problem. It is the amount of energy needed to transport a bit from the closest neighbor.

Data Transport Service gives  a reliable connection for moving large amounts of data at very fast speeds.

Learn more from

brainly.com/question/17695822

6 0
3 years ago
What are screenshots helpful for ?
alex41 [277]

A

Creating.

Explanation:

What else would they be used for

4 0
3 years ago
Read 2 more answers
Other questions:
  • Just giving this a shot, Which of the following statements about RAM are TRUE? Select all that apply.
    10·1 answer
  • In the 1960s, techniques were developed that allowed individuals to fool the phone system into providing free access to long dis
    14·1 answer
  • Rachel uses a word processor to write short stories. However, most of her time is spent toying with the keys, rather than in wri
    13·2 answers
  • What is the keyboard shortcut for the Undo command?
    8·1 answer
  • Digital Subscriber Line (DSL) is the only Internet connection option available for a small office in the middle of nowhere. Whic
    15·1 answer
  • In the Sender Message Channel Receiver (SMCR) model, the ______ is the large, bureaucratic organization that produces messages.
    5·1 answer
  • Can anyone help me with a mental ability work plzz
    12·1 answer
  • How many total bits are required for a direct-mapped cache with 128 blocks and a block size of 8 bytes, assuming a 4GB main memo
    15·1 answer
  • What program command saves a copy of a file under a different name
    14·1 answer
  • 3. What of the following is the main components of computer system?
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!