Question: a ) Create a class, Doctor, with the following data members and methods. Note all data members and class variables should be private ( _
a Create a class, Doctor, with the following data members and methods. Note all data
members and class variables should be private
Data Members:
dname: stores the name of the Doctor.
title: stores the title of the Doctor Professor Associate Professor,
Assistant Professor, Specialist Methods:
init: initializes the name and type to values passed as parameters.
Get and Set methods for dname and title.
eq : attendee object are equal if their name and title are the
same.
lt : an Doctor is less than another based on their alphabetic
titles, if the titles are the same it then compares according to
alphabetic name.
repr: returns a string representation of a Doctor object.
Format: Title Doctor Name
b Create a class, Private, which is a subclass of Doctor. The subclass has the following data members and methods. Note all data members and class variables should be private
Data Members:
Methods:
patients: stores the integer number of patients seen by the Doctor. treatmentFee: stores the fee per patient for a treatment.
init: initializes the dname and title by calling the super class init method. Initializes the number of patients and treatment fee to values passed as parameters.
calculatepayment : calculates and returns the payment, which is the number of patients multiplied by the treatment fee.
repr: returns a string representation of a Private object. Format: Title Doctor Name Payment: payment
c Create a class, State, which is a subclass of Doctor. The subclass has the following data members and methods. Note all data members and class variables should be private
Data Members:
salary: stores the monthly salary of the State Doctor.
baseBonus: the same for all State Doctors, defined as a static class
member, not inside the init method. Constant value Methods:
init: initializes the dname and title by calling the super class init method. Initializes the salary to the value passed as parameters.
calculatepayment : calculates and returns the payment, according to the following: Professors receive their salary plus of the baseBonus, Associate Professors receive their salary plus of the baseBonus, AssistantProfessors and Specialists receive their salary plus of the baseBonus.
repr: returns a string representation of a State object. Format: Title Doctor Name Payment: payment
d Write an application, Labpy that does the following:
Reads the data from the file doctordata.txt Using the data from the file, creates
Doctor objects State or Private and if the Doctor is not already in the list, adds
the Doctor to a list.
Sorts the list of Doctors.
Displays the sorted list of Doctors.
Sample Run:
Professor Alyssa Padilla Payment: not added, duplicate!
Assistant Professor Alonzo Ballard Payment:
Assistant Professor Tracey Russell Payment: Associate Professor Andrea Howard Payment: Associate Professor Rosalie West Payment:
Associate Professor Sue Beck Payment:
Professor Alyssa Padilla Payment:
Professor Darryl Walker Payment:
Professor Jeremiah Bailey Payment:
Specialist Andrew Austin Payment:
Specialist Lyle Romero Payment:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
