/
SofiMut
/
simpleAndCredit
Обзор
Документация
Войти
/
SofiMut
/
simpleAndCredit
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Credit.java
29 строк
625 B
Софья Степанова
upload files
27 июн 2025, 06:58
27 июн 2025, 06:58
c1a92ba
Код
Авторство
О чём код?
public class Credit extends Account { public long limit; public Credit(long limit) { this.limit = limit; } @Override boolean add(long amount) { if (balance + amount <= 0) { // баланс кредитного счета не может быть положительным balance += amount; return true; } return false; } @Override boolean pay(long amount) { if (balance - amount >= limit) { balance -= amount; return true; } return false; } }