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