Advertisement
Guest User

Untitled

a guest
Apr 16th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. KORKO = 0.02
  2.  
  3. class Account:
  4. def __init__(self, account_number, customer_name, balance):
  5. self.__account_number = account_number
  6. self.__customer_name = customer_name
  7. self.__balance = balance
  8.  
  9. def balance(self):
  10. return self.__balance
  11.  
  12. def add_korko(self, korko):
  13. self.__balance += korko * self.__balance
  14.  
  15. def do_talletus(self, sum):
  16. self.__balance += sum
  17.  
  18. def do_nosto(self, sum):
  19. self.__balance -= sum
  20.  
  21. def merge_accounts(self, other_account):
  22. self.__balance += other_account.balance
  23.  
  24.  
  25. """
  26. Tekstitiedosto oli muotoa:
  27.  
  28. accounts.txt:
  29. 102;300.25;Matti
  30. 125;1250;Kaaleppi
  31.  
  32. ja siihen oli tehty valmiit funktiot jotka lukee ja
  33. lisää oliot accounts -dictiin
  34. """
  35.  
  36.  
  37. def main():
  38. accounts = {} # tyyliin {102: object, 125: object}
  39.  
  40. # Kaksi valmista funktiota read_account_name() ja read_float
  41. # joita kantsii
  42. # Hyödyntää, kun luetaan account_number Ja summa kohdissa M, W, ja D
  43.  
  44.  
  45. while True:
  46. command = input("")
  47.  
  48. if command == "L":
  49. # Listaa kaikki asiakkaat ja niiden tilit
  50. # Valmiiksi tehty toimiva funktio
  51.  
  52. elif command == "I":
  53. # LIsää korko kaikille accounteille
  54.  
  55. elif command == "D":
  56. # Talleta rahaa käyttäjän tilille
  57.  
  58. elif command == "W":
  59. # NOsta rahaa käyttäjän tililtä
  60.  
  61. elif command == "M":
  62. # Yhdistä kaksi tiliä, joiden asiakasnimet ovat samat
  63. # Ja poista toinen niistä tileistä
  64.  
  65.  
  66. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement