Question

In: Computer Science

Using Python, Write an app for patients such as patients requiring surgery and patients who are...

Using Python,

Write an app for patients such as patients requiring surgery and patients who are pregnant and relevant functionalities.

Note : It's not a complex app. It is for my fundamental 2 class to understand the inheritance concept. Simpler the better.

Solutions

Expert Solution

Thanks for posting the question, here is a simple python code that demonstrates inheritance using the given example in the question. Please refer the screenshot for the code indentation and output

Incase you have any questions, do post it, and i'll be happy to assist you right away !

_____________________________________________________________________________________________

class Patient():
    
    def __init__(self, name,admission_date,doctor_name):
        self.name=name
        self.admission_date=admission_date
        self.dr_name=doctor_name
    
    def get_patient_name(self):
        return self.name
    def get_admission_date(self):
        return self.admission_date
    def get_doctor_name(self):
        return self.dr_name
    
    def __str__(self):
        return self.name+' was admitted on '+self.admission_date+' and is under Dr. '+self.dr_name


class Surgery(Patient):
    
    def __init__(self,name, dt,doctor_name,surgery_type,surgery_date):
        super().__init__(name, dt, doctor_name)
        self.surgery_type=surgery_type
        self.surgery_date=surgery_date
    def get_surgery_type(self):
        return self.surgery_type
    def set_surgery_type(self,type):
        self.surgery_type=type
    def get_surgery_date(self):
        return self.surgery_date
    def set_surgery_date(self,date):
        self.surgery_date=date
    def __str__(self):
        return Patient.__str__(self)+' and will undergo '+self.surgery_type+' surgery on '+self.surgery_date

class Pregnant(Patient):
    def __init__(self,name, dt,doctor_name,pregnancy_weeks):
        super().__init__(name, dt, doctor_name)
        self.weeks=pregnancy_weeks
    def get_pregnancy_weeks(self):
        return self.weeks
    def get_weeks_left(self):
        return 9*4-self.weeks
    def __str__(self):
        return Patient.__str__(self)+ ' is '+str(self.weeks)+' weeks pregnant and expecting after '+str(self.get_weeks_left())+' weeks.'
    

peter=Surgery('Peter','02/06/2019','William Cambell','Appendectomy','02/10/2019')
print(peter)
peter.set_surgery_date('03/01/2019')
peter.set_surgery_type('Cholecystectomy')
print(peter)

alice=Pregnant('Alice','02/06/2019','Sarah Williams',30)
print(alice)
    _____________________________________________________________________________________

image screenshot

thank you !

: )


Related Solutions

Write about the epidopmology of smoking and using a sober tool app successfully for people who...
Write about the epidopmology of smoking and using a sober tool app successfully for people who are ready to quit smoking
[4 marks] Write a Python program for a “Deliver-Eat!” app that asks the user for their...
[4 marks] Write a Python program for a “Deliver-Eat!” app that asks the user for their tip amount. If the user tips less than $5 they should receive a 1-star rating. If the user tips $5 or more they should receive a 5-star rating. Your program should match the output below. User input is in red. >>> How much would you like to tip? $4.50 >>> Here is your rating! * >>> How much would you like to tip? $7.20...
Write a Flask app in which a Python script prompts the user to enter a string...
Write a Flask app in which a Python script prompts the user to enter a string and then that string, as entered, gets displayed on an otherwise blank HTML file, called output.html. Show the Python/Flask code and the html code of the output.html file, one below the other as part of your answer.
Why are post-operative patients (patients who just had surgery) at risk for atelectasis and/or pneumonia (PNA)?...
Why are post-operative patients (patients who just had surgery) at risk for atelectasis and/or pneumonia (PNA)? What nursing interventions can help prevent these complications? (typed please).
Why are post-operative patients (patients who just had surgery) at risk for atelectasis and/or pneumonia (PNA)?...
Why are post-operative patients (patients who just had surgery) at risk for atelectasis and/or pneumonia (PNA)? What nursing interventions can help prevent these complications? please type.
Using Python and Kivy to create a App to ask users 5 questions with Yes or...
Using Python and Kivy to create a App to ask users 5 questions with Yes or No button. 1. Are you older than 14? 2. Did you pass 8th or 9th Grade? 3. Are you ready gor highschool? 4. Do you have 4 more years to complete highschool? 5. Are you homeschool? If the users click Yes for 3 questions or more than you should get a results page saying this users is in highschool or else the user is...
In a sample of 1901 patients who underwent a certain type of surgery, 22% experienced complications....
In a sample of 1901 patients who underwent a certain type of surgery, 22% experienced complications. Find a 90% confidence interval for the proportion of all those undergoing this surgery who experience complications.
For a simple random sample of forty patients who have recently had knee surgery, the administrator...
For a simple random sample of forty patients who have recently had knee surgery, the administrator of a physical therapy facility finds a 90% CI of (5.76, 7.25) for the average postoperative performance scores on a knee flexibility test. (b) Let’s say I now want to be 99% confident. What value will be in the center of the 99% confidence interval? (c) We are not told whether knee flexibility scores follow a normal distribution. Is the CI we computed still...
The success rate of corneal transplant surgery is 85%. The surgery is performed on six patients....
The success rate of corneal transplant surgery is 85%. The surgery is performed on six patients. What is the probability of the surgery being successful on four patients?
The success rate of corneal transplant surgery is 85%. The surgery is performed on six patients....
The success rate of corneal transplant surgery is 85%. The surgery is performed on six patients. Construct a binomial distribution. Graph the binomial distribution using a histogram and describe its shape. Find the mean, variance, and standard deviation of the binomial distribution and interpret the results.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT