-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcashbox.py
More file actions
24 lines (20 loc) · 813 Bytes
/
cashbox.py
File metadata and controls
24 lines (20 loc) · 813 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class Cashbox:
def __init__(self, model: str = "Model MK-03"):
self.__model = model
self.__balance = 0
def add_cash(self, amount: float) -> bool:
if amount >= 0:
self.__balance += amount
return True
else:
print("-> Ошибка! Вы ввели неверную сумму.")
return False
def sub_cash(self, amount: float) -> bool:
if amount >= 0 and self.__balance >= amount:
self.__balance -= amount
return True
else:
print("-> Ошибка! Вы ввели неверную сумму или в кассе недостаточно средств.")
return False
def get_balance(self) -> float:
return self.__balance