/
SamMih
/
HOMEWORK5
Обзор
Документация
Войти
/
SamMih
/
HOMEWORK5
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Book.java
41 строка
1 KB
SamMih
HOMEWORK5
05 июн 2025, 15:15
05 июн 2025, 15:15
0b834a2
Код
Авторство
О чём код?
public class Book { public String title; public int releaseYear; public int pages; public Author author = new Author("Александр", "Пушкин", 10); public Book(String title, int releaseYear, int pages) { this.title = title; this.releaseYear = releaseYear; this.pages = pages; } public boolean isBig() { if (pages > 500) { return true; } else { return false; } } public boolean matches(String word) { String name = author.nameAuthor(); String surname = author.surnameAuthor(); if (title.contains(word) || name.contains(word) || surname.contains(word)) { return true; } else { return false; } } public int estimatePrice() { int rating = author.ratingAuthor(); int costOfBook = (int) Math.floor((3 * pages) * Math.sqrt(rating)); if (costOfBook < 250) { return 250; } else { return costOfBook; } } }