Question

Write a python program that computes a patients bill for a hospital stay. The different components of the program are The patientAccount class The Surgery class The Pharmacy class The main program -Th...

Write a python program that computes a patients bill for a hospital stay. The different components of the program are The patientAccount class The Surgery class The Pharmacy class The main program -The PatientAccount class will keep a total of the patient's charges. It will also keep track of the number of days spent in the hospital. The group must decide on the hospital's daily rate. -The Surgery class will have stored within it the charges for at least five types of surgery. It can update the charges variable of the PatientAccount class. -The Pharmacy class will have stored within it the price of at least five types of medication. It can update the charges variable of the PatientAccount class. -The student who designs the main program will design a menu that allows the user to enter a type of surgery and a type of medication, and check the patient out of the hospital. when the patient checks out, the total charges should be displayed.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#Python code

#patientAccount
class PatientAccount:
def __init__(self):
self.__hospitalCharge=0.0
self.__numberOfDays=0
self.__hospitalDailyRate=0.0
self.__surgeryCharge=0.0
self.__medicineCharge=0.0
def ComputeBill(self):
self.__hospitalCharge=self.__numberOfDays*self.__hospitalDailyRate+self.__surgeryCharge+self.__medicineCharge
return self.__hospitalCharge
def setNumberofDays(self,days):
self.__numberOfDays=days
def setHospitalDailyRate(self,rate):
self.__hospitalDailyRate= rate
def setSurgeryCharge(self, charge):
self.__surgeryCharge=charge
def setMedicineCharge(self,charge):
self.__medicineCharge= charge
# class Surgery
class Surgery(PatientAccount):
def __init__(self,surgeryType):
self.__surgeryType= surgeryType   
def ComputeSurgeryCharge(self):
if self.__surgeryType=="appendectomy":
self.setSurgeryCharge(99.00)
elif self.__surgeryType=="breast biopsy":
self.setSurgeryCharge(55.67)
elif self.__surgeryType=="cataract surgery":
self.setSurgeryCharge(65.78)
elif self.__surgeryType=="cesarean ":
self.setSurgeryCharge(90.98)
elif self.__surgeryType=="coronary artery bypass":
self.setSurgeryCharge(45.67)
else:
self.setSurgeryCharge(0.0)
  

#Pharmacy class
class Pharmacy(PatientAccount):
def __init__(self,medicineType):
self.__medicineType=medicineType
def computeMedicineCharge(self):
if self.__medicineType=="antipyretics":
self.setMedicineCharge(89.90)
elif self.__medicineType=="analgesics":
self.setMedicineCharge(78.99)
elif self.__medicineType=="antimalarial ":
self.setMedicineCharge(78.99)
elif self.__medicineType=="antibiotics":
self.setMedicineCharge(78.99)
elif self.__medicineType=="antiseptics":
self.setMedicineCharge(78.99)
else:
self.setMedicineCharge(0.0)

#Main function
def main():
#Menu
rate= float(input("Enter hospital rate: "))
days = int(input("Enter Number of days: "))

#create PatientAccount object
patient= PatientAccount()
patient.setHospitalDailyRate(rate)
patient.setNumberofDays(days)

#create menu
print("Select surgery type: ")
print("appendectomy\nbreast biopsy\ncataract surgery\ncesarean\ncoronary artery bypass")
surgeryType= input()
print("Select medicine type: ")
print("antipyretics\nanalgesics\nantimalarial\nantibiotics\nantiseptics")
medicineType= input()
  
#create Surgery object
surgery = Surgery(surgeryType.lower())
surgery.ComputeSurgeryCharge()

#create Pharmacy object
medicine = Pharmacy(medicineType.lower())
medicine.computeMedicineCharge()

total=patient.ComputeBill()

print("Total bill to pay: $"+str(total))
#call main ()
main()

#output

Enter hospital rate: 45.60 Enter Number of days: 5 Select surgery type: appendectomy breast biopsy cataract surgery cesarean

#Screenshots for indentation help

#patientAc count Eclass PatientAccount: 白 def-initー(self): self. hospitalCharge-0.0 self. numberOfDays-0 self. hospitalDailyR# class Surgery Eclass Surgery (PatientAccount) def _init_(self,surgeryType): self._surgeryType surgeryType if self._surgeryT

#Pharmacy class def init self,medicineType): def computeMedicineCharge(self): Eclass Pharmacy (PatientAccount): self. medicin

//if you need any help regarding this solution ........... please leave a comment ....... thanks

Add a comment
Know the answer?
Add Answer to:
Write a python program that computes a patients bill for a hospital stay. The different components of the program are The patientAccount class The Surgery class The Pharmacy class The main program -Th...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a program that computes and displays the charges for a patient’s hospital stay. First, the...

    Write a program that computes and displays the charges for a patient’s hospital stay. First, the program should ask if the patient was admitted as an in-patient or an out-patient. If the patient was an in-patient, the following data should be entered: The number of days spent in the hospital The daily rate Hospital Medication Charges Charges for hospital services (labs, tests, etc.) The program should ask for the following data if the patient was an out-patient: Charges for hospital...

  • The project description As a programmer; you have been asked to write a program for a Hospital wi...

    program Java oop The project description As a programmer; you have been asked to write a program for a Hospital with the following The Hospital has several employees and each one of them has an ID, name, address, mobile number, email and salary. . The employees are divided into Administration staff: who have in addition to the previous information their position. Nurse: who have their rank and specialty stored in addition to the previous o o Doctor: who have the...

  • please Identify the key points and main thesis of the article 2. Describe the skills you...

    please Identify the key points and main thesis of the article 2. Describe the skills you will need to develop to manage the hospital of the future. use critical analysis doing these questions Suggestion for writing assignmemnt make believe the reader has never read the article -what are the key points you would want the reader to know in order to understand the hospital of the future. In addition, managers, executives do not have time to read--so again what key...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT