Advertisement
UniQuet0p1

Untitled

Nov 10th, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.49 KB | None | 0 0
  1. """Bank."""
  2. import datetime
  3. import random
  4. import string
  5.  
  6.  
  7. class PersonError(Exception):
  8. """Person error."""
  9. pass
  10.  
  11.  
  12. class TransactionError(Exception):
  13. """Transaction error."""
  14. pass
  15.  
  16.  
  17. class Person:
  18. """Person class."""
  19.  
  20. def __init__(self, first_name: str, last_name: str, age: int):
  21. """
  22. Person constructor.
  23.  
  24. :param first_name: first name
  25. :param last_name: last name
  26. :param age: age, must be greater than 0
  27. """
  28. pass
  29.  
  30. @property
  31. def full_name(self) -> str:
  32. """Get person's full name. Combination of first and last name."""
  33. return ""
  34.  
  35. @property
  36. def age(self) -> int:
  37. """Get person's age."""
  38. return -1
  39.  
  40. @age.setter
  41. def age(self, value: int):
  42. """Set person's age. Must be greater than 0."""
  43. pass
  44.  
  45. def __repr__(self) -> str:
  46. """
  47. Person representation.
  48.  
  49. :return: person's full name
  50. """
  51. pass
  52.  
  53.  
  54. class Bank:
  55. """Bank class."""
  56.  
  57. def __init__(self, name: str):
  58. """
  59. Bank constructor.
  60.  
  61. :param name: name of the bank
  62. """
  63. pass
  64.  
  65. def add_customer(self, person: Person) -> bool:
  66. """
  67. Add customer to bank.
  68.  
  69. :param person: person object
  70. :return: was customer successfully added
  71. """
  72. pass
  73.  
  74. def remove_customer(self, person: Person) -> bool:
  75. """
  76. Remove customer from bank.
  77.  
  78. :param person: person object
  79. :return: was customer successfully removed
  80. """
  81. pass
  82.  
  83. def __repr__(self) -> str:
  84. """
  85. Bank representation.
  86.  
  87. :return: name of the bank
  88. """
  89. pass
  90.  
  91.  
  92. class Transaction:
  93. """Transaction class."""
  94.  
  95. def __init__(self, amount: float, date: datetime.date, sender_account: 'Account', receiver_account: 'Account',
  96. is_from_atm: bool):
  97. """
  98. Transaction constructor.
  99.  
  100. :param amount: value
  101. :param date: date of the transaction
  102. :param sender_account: sender's object
  103. :param receiver_account: receiver's object
  104. :param is_from_atm: is transaction from atm
  105. """
  106. pass
  107.  
  108. def __repr__(self) -> str:
  109. """
  110. Transaction representation.
  111.  
  112. :rtype: object's values displayed in a nice format
  113. """
  114. pass
  115.  
  116.  
  117. class Account:
  118. """Account class."""
  119.  
  120. def __init__(self, balance: float, person: Person, bank: 'Bank'):
  121. """
  122. Account constructor.
  123.  
  124. :param balance: initial account balance
  125. :param person: person object
  126. :param bank: bank object
  127. """
  128. pass
  129.  
  130. @property
  131. def balance(self) -> float:
  132. """Get account's balance."""
  133. return -1
  134.  
  135. def deposit(self, amount: float, is_from_atm: bool = True):
  136. """Deposit money to account."""
  137. pass
  138.  
  139. def withdraw(self, amount: float, is_from_atm: bool = True):
  140. """Withdraw money from account."""
  141. pass
  142.  
  143. def transfer(self, amount: float, receiver_account: 'Account'):
  144. """Transfer money from one account to another."""
  145. pass
  146.  
  147. def account_statement(self, from_date: datetime.date, to_date: datetime.date) -> list:
  148. """All transactions in given period."""
  149. pass
  150.  
  151. def get_debit_turnover(self, from_date: datetime.date, to_date: datetime.date) -> float:
  152. """
  153. Get total income in given period.
  154.  
  155. :param from_date: from date object (included)
  156. :param to_date: to date object (included)
  157. :return: debit turnover number
  158. """
  159. pass
  160.  
  161. def get_credit_turnover(self, from_date: datetime.date, to_date: datetime.date) -> float:
  162. """
  163. Get total expenditure in given period.
  164.  
  165. :param from_date: from date object (included)
  166. :param to_date: to date object (included)
  167. :return: credit turnover number
  168. """
  169. pass
  170.  
  171. def get_net_turnover(self, from_date: datetime.date, to_date: datetime.date) -> float:
  172. """
  173. Get net turnover (income - costs) in given period.
  174.  
  175. :param from_date: from date object (included)
  176. :param to_date: to date object (included)
  177. :return: net turnover number
  178. """
  179. pass
  180.  
  181. def __repr__(self) -> str:
  182. """
  183. Account representation.
  184.  
  185. :return: account number
  186. """
  187. pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement