/
imovannanis
/
classIntroHW
Обзор
Документация
Войти
/
imovannanis
/
classIntroHW
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Book.java
38 строк
934 B
imovannanis
upload files
15 апр 2025, 21:49
15 апр 2025, 21:49
c31c3b0
Код
Авторство
О чём код?
public class Book { public String title; public int releaseYear; public Author author ; public int pages; public Book(String title, int releaseYear,Author author,int pages) { this.title = title; this.releaseYear = releaseYear; this.author = author; this.pages = pages; } public String isBig() { if (pages <= 500){ return "This book isn't big"; }else { return "This book is big"; } } /* public boolean isBigSimple() { return pages > 500; } */ public boolean matches(String word) { return author.name.contains(word) || title.contains(word) || author.surname.contains(word); } public int estimatePrice() { double price = (int) (pages * 3 * Math.sqrt(author.rating)); return Math.max((int) Math.floor(price), 250); } }