/
magnetoc
/
homework_class_structure
Обзор
Документация
Войти
/
magnetoc
/
homework_class_structure
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Book.java
37 строк
885 B
magnetoc
pro1
25 июл 2026, 16:17
25 июл 2026, 16:17
19e78c5
Код
Авторство
О чём код?
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 boolean isBig() { if (pages > 500) { return true; } else { return false; } } public boolean matches(String word) { if (title.contains(word) || (author.name + " " + author.surname).contains(word)) { return true; } else { return false; } } public int estimatePrice() { if (3*pages > 250) { return (int) Math.floor((3*pages) * Math.sqrt(author.rating)); } else { return 250; } } }