/
SofiMut
/
booksRating
Обзор
Документация
Войти
/
SofiMut
/
booksRating
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Book.java
45 строк
1 KB
SofiMut
upload files
22 май 2025, 13:55
22 май 2025, 13:55
e178338
Код
Авторство
О чём код?
public class Book { Author author; public String title; public int releaseYear; public int pageCount; public Book(Author author, String title, int releaseYear, int pageCount) { this.author = author; this.title = title; this.releaseYear = releaseYear; this.pageCount = pageCount; } public boolean isBig() { return pageCount > 500; } public boolean matches(String word) { return title.contains(word) || author.name.contains(word) || author.surname.contains(word); } public int estimatePrice() { double price = pageCount * 3 * Math.sqrt(Author.maxRating); int cost = (int) Math.floor(price); if (cost <= 250) { return 250; } else { return cost; } } public String toString() { return "Произведение: " + title + " (" + releaseYear + " год, " + pageCount + " страниц) " + "\nАвтор: " + author.name + " " + author.surname; } }