/
Zaytsev_Sergey
/
Java_4
Обзор
Документация
Войти
/
Zaytsev_Sergey
/
Java_4
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Book.java
34 строки
1 KB
Zaytsev_Sergey
upload files
23 фев 2026, 18:14
Верифицирован
23 фев 2026, 18:14
98754ae
Код
Авторство
О чём код?
public class Book { public String title; public int releaseYear; public int pages; public Author author; public Book(String title, int releaseYear, int pages, Author author) { this.title = title; this.releaseYear = releaseYear; this.pages = pages; this.author = author; } public boolean isBig() { return pages > 500; } public boolean matches(String word) { return title.toLowerCase().contains(word.toLowerCase()) || (author.name.toLowerCase().contains(word.toLowerCase()) && author.surname.toLowerCase().contains(word.toLowerCase())); } public int estimatePrice() { if (pages * 3 * Math.floor(Math.sqrt(author.rating)) > 250) { return (int) (pages * 3 * Math.floor(Math.sqrt(author.rating))); } else { return 0; } } @Override public String toString() { return title + " " + releaseYear + " " + pages + " " + author.name + " " + author.surname + " " + author.rating; } }