Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
814
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. #OOPR-Assgn-3
  2. '''
  3. Implement the Customer class based on the identified class structure and details given below:
  4.  
  5. 1. Consider all instance variables and methods to be public
  6. 2. Assume that bill_amount is initialized with total bill amount of the customer
  7. 3. Customer is eligible for 5% discount on the bill amount
  8. 4. purchases(): Compute discounted bill amount and pay bill
  9. 5. pays_bill(amount): Display, <customer_name> pays bill amount of Rs. <amount>
  10.  
  11. Represent few customers, invoke purchases() method and display the details.
  12.  
  13.  
  14. Note: Verification is done only for the class structure.
  15. '''
  16.  
  17.  
  18. #Start writing your code here
  19. class Customer:
  20. def __init__(self):
  21. self.customer_name=None
  22. self.bill_amount=None
  23.  
  24. def purchases(self):
  25. self.bill_amount=self.bill_amount-(self.bill_amount*0.05)
  26.  
  27. def pays_bill(self,amount):
  28. self.bill_amount+=amount
  29. purchases()
  30. print(self.customer_name,"pays bill amount of Rs.",bill_amount)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement