create a class name insurance using functions in python INSU

create a class name insurance using functions in python

INSURANCE CLASS: The insurance class has three attributes and one method. All three attributes must be given when the insurance object is created. The name attribute stores the name of the insurance plan as a string. The copay attribute stores the plan’s copay amount. The deductible attribute stores the plan’s deductible amount. The patient bill method takes as input the treatment cost and the patient’s total medical expenses (which below is called total exp) and returns the amount the patient should be billed for the treatment. Please feel free to google this, but basically the concept of a copay and a deductible work as follows. The patient must pay full price for every treatment until they have payed a total of deductible dollars, after which they pay copay dollars for each treament (unless the treatment costs less, in which case they pay the full cost and no more). Normally this process resets every year, but to simplify things I will not require you to reset this process. For us, once the patient meets the deductible, they only have to pay the copay for the rest of their life.

Solution

Code:

class Insurance:
def __init__(self,name,copay, deductible ):
self.name = name
self.copy = copay
self.deductible = deductible

def bill(self,treatmentCost,medical_expenses):
if (self.deductible == 0 ):
       return self.copy + medical_expenses
elif (self.deductible > treatmentCost):
       self.deductible = self.deductible - treatmentCost
       return treatmentCost + medical_expenses
else:
       self.deductible = 0;
       return self.copy + medical_expenses

create a class name insurance using functions in python INSURANCE CLASS: The insurance class has three attributes and one method. All three attributes must be g

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site