Doctors in a hospital in New York City is checking patients for symptoms of Covid-19.
A Doctor has these attributes/properties:
Design the Doctor class, including a constructor method, accessor methods for all of the class variables, and a mutator method, minusHealth, for the health rating. This mutator method simply deducts 1 from the current health rating as long as the current rating is greater than 1.
In a computer program we should be able to construct a new Doctor as follows:
d = Doctor("James Pepple","wd-0002")
Test your design with this program:
d = Doctor("James Pepple","wd-0002")
print(d.getHealthRating())
while d.getHealthRating() > 1:
print("Updating health rating!")
d.minusHealth()
print("The doctor's current health rating is ", d.getHealthRating())
Save your solution as covidTemps-1.py
Design a new Doctor class method, incidentLog.
This method asks the user to write an incident log entry. The log is appended to a text file that has the same name as the Doctor's id eg if the Doctor's id is "wd-0002", then the text file being written to will be wd-0002.txt
The doctor's current health rating is concatenated to the end of a log entry.
Don't forget to close the file when appropriate to do so!
Test your design with this program:
d1 = Doctor("James Pepple","wd-0002")
d2 = Doctor("Jenny Bisset","wd-7302")
d2.minusHealth()
d1.incidentLog()
d2.incidentLog()
After you run your code, 2 text files should have 1 incident log each, one ending with 5 and one ending with 4
Save your solution as covidTemps-2.py
You will perform some adaptive maintenance on your program because a new requirement has been identified.
Design a new Doctor class method called viewLog().
This method will display the first 5 lines of any incident log file and then ask the user if they want to see the next 5 lines. If the answer is no, the method ends. If the answer is yes, the method will display the next five lines. This process continues until the user enters no or the end of the file is reached.
Save your solution as covidTemps-3.py
Write pseudocode for Task 2.
Make sure you are thoughtful when testing your solution.
If your code has a validation check, test your code with acceptable/valid data and unacceptable/invalid data.