Question: 3 Implement the design of the Doctor and Engineer class derived from Person  class so that the following code generates the output below: class Person:    def __init__(self, name, contact):      self.name = name      self.contact = contact    def __str__(self):      s = f"Name: {self.name}\nContact: {self.contact}"      return s #Write your code here d = Doctor("Dr Strange", "4585632", "Neurosurgery", "DMC") d.add_patients("Dhaka Abdur Rahim", "Dhaka John Cena", "Narayanganj John  Wick", "Comilla CM Punk") print("1.=========================================================") print(d) print("2.=========================================================") d.show_patient_list("Dhaka") print("3.=========================================================") d.show_patient_list("Rajshahi") print("4.=========================================================") d.add_patients("Narayanganj Naruto Uzumaki") print("5.=========================================================") print(d) print("6.=========================================================") eng = Engineer("Howard Wolowitz", "982685", "Mechanical") eng.add_projects("Mongol Tori Bangladesh", "Duburi Bangladesh", "Curiosity  Rover USA", "Perseverence USA") print("7.=========================================================") print(eng) OUTPUT: 1.========================================================= Doctor Details: Name: Dr Strange Contact: 4585632 Speciality: Neurosurgery Hospital: DMC Patients List: {'Dhaka': ['Dhaka Abdur Rahim', 'Dhaka John Cena'], 'Narayanganj':  ['Narayanganj John Wick'], 'Comilla': ['Comilla CM Punk']} 2.========================================================= Patients from Dhaka: Dhaka Abdur Rahim Dhaka John Cena 3.========================================================= Dr Strange has not patients from Rajshahi 4.========================================================= 5.========================================================= Doctor Details: Name: Dr Strange Contact: 4585632 Speciality: Neurosurgery Hospital: DMC Patients List: {'Dhaka': ['Dhaka Abdur Rahim', 'Dhaka John Cena'], 'Narayanganj':  ['Narayanganj John Wick', 'Narayanganj Naruto Uzumaki'], 'Comilla':  ['Comilla CM Punk']} 6.========================================================= 7.========================================================= Engineer Details: Name: Howard Wolowitz Contact: 982685 Field: Mechanical Project List: {'Bangladesh': ['Mongol Tori Bangladesh', 'Duburi  Bangladesh'], 'USA': ['Curiosity Rover USA', 'Perseverence USA']}

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...
icon
Related questions
Question

Question: 3
Implement the design of the Doctor and Engineer class derived from Person 
class so that the following code generates the output below:

class Person:
   def __init__(self, name, contact):
     self.name = name
     self.contact = contact

   def __str__(self):
     s = f"Name: {self.name}\nContact: {self.contact}"
     return s
#Write your code here


d = Doctor("Dr Strange", "4585632", "Neurosurgery", "DMC")
d.add_patients("Dhaka Abdur Rahim", "Dhaka John Cena", "Narayanganj John 
Wick", "Comilla CM Punk")
print("1.=========================================================")
print(d)
print("2.=========================================================")
d.show_patient_list("Dhaka")
print("3.=========================================================")
d.show_patient_list("Rajshahi")
print("4.=========================================================")
d.add_patients("Narayanganj Naruto Uzumaki")
print("5.=========================================================")
print(d)
print("6.=========================================================")
eng = Engineer("Howard Wolowitz", "982685", "Mechanical")
eng.add_projects("Mongol Tori Bangladesh", "Duburi Bangladesh", "Curiosity 
Rover USA", "Perseverence USA")
print("7.=========================================================")
print(eng)

OUTPUT:
1.=========================================================
Doctor Details:
Name: Dr Strange
Contact: 4585632
Speciality: Neurosurgery
Hospital: DMC
Patients List:
{'Dhaka': ['Dhaka Abdur Rahim', 'Dhaka John Cena'], 'Narayanganj': 
['Narayanganj John Wick'], 'Comilla': ['Comilla CM Punk']}
2.=========================================================
Patients from Dhaka:
Dhaka Abdur Rahim
Dhaka John Cena
3.=========================================================
Dr Strange has not patients from Rajshahi
4.=========================================================
5.=========================================================
Doctor Details:
Name: Dr Strange
Contact: 4585632
Speciality: Neurosurgery
Hospital: DMC
Patients List:
{'Dhaka': ['Dhaka Abdur Rahim', 'Dhaka John Cena'], 'Narayanganj': 
['Narayanganj John Wick', 'Narayanganj Naruto Uzumaki'], 'Comilla': 
['Comilla CM Punk']}
6.=========================================================
7.=========================================================
Engineer Details:
Name: Howard Wolowitz
Contact: 982685
Field: Mechanical
Project List: {'Bangladesh': ['Mongol Tori Bangladesh', 'Duburi 
Bangladesh'], 'USA': ['Curiosity Rover USA', 'Perseverence USA']}

Expert Solution
steps

Step by step

Solved in 3 steps with 7 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
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…
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)
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
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY