/
Elina
/
Abstract
Обзор
Документация
Войти
/
Elina
/
Abstract
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
CreditAccount.java
43 строки
932 B
Elina
commit
06 апр 2025, 14:16
06 апр 2025, 14:16
2c2259d
Код
Авторство
О чём код?
public class CreditAccount extends Account { public long limit; public CreditAccount(long balance, long limit) { super(balance); this.limit = limit; } @Override public boolean add(long amount) { long b = limit + amount; if (b <= 0) { return true; } ; return false; } @Override public boolean pay(long amount) { long x = balance - amount; if (x >= limit) { balance -= amount; return true; } return false; } @Override public boolean transfer(Account account, long amount) { long x = account.balance + amount; if (x >= 0) { account.balance = account.balance + amount; return true; } return false; } public long getLimit() { return limit; } }