create class name treatment in python TREATMENT CLASS The tr
create class name treatment in python
TREATMENT CLASS: The treatment class has no methods, just two attributes which must be given when a treatment object is created. The name attribute stores the name of the treatment as a string. The cost attribute stores the cost of the treatment as a number.
Solution
class treatment:
\'common base class for all Treatment\'
name=\"rabipur\"
cost=12
def_init_(self,name,cost):
self.name=name
self.cost=cost
def displaytreatment(self):
print \"name:\",self.name,\",cost\",self.salary
tr1=treatment(\"rabipur\",12)
tr2=treatment(\"xyz\"120)
tr1.displaytreatment()
tr2.displaytreatment()
