/
SamMih
/
HOMEWORK8_Abstractions_and_Interface
Обзор
Документация
Войти
/
SamMih
/
HOMEWORK8_Abstractions_and_Interface
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Account.java
41 строка
938 B
SamMih
HOMEWORK8_Abstractions_and_Interface
03 июл 2025, 15:42
03 июл 2025, 15:42
e793d82
Код
Авторство
О чём код?
public abstract class Account { public long amount; public Account(long amount) { this.amount = amount; } protected long balance; // = amount; public boolean add(long amount) { return true; } public boolean pay(long amount) { return true; } public boolean Removal(long amount) { if (amount > 0 && balance >= amount) { balance -= amount; return true; } return false; } public boolean Replenishment(long amount) { if (amount > 0) { balance += amount; return true; } return false; } public boolean transfer(Account account, long amount) { if (Removal(amount)) { account.Replenishment(amount); return true; } return false; } public long getBalance() { return balance; } }