Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a Book class with the following attributes and methods: Attributes: title ( String ) author ( String ) publicationYear ( int ) ISBN (
Create a Book class with the following attributes and methods:
Attributes:
title String
author String
publicationYear int
ISBN String
available boolean
price double
totalAvailableBooks int static
Methods:
Constructor: To initialize each field with given parameters, and increments totalAvailableBooks.
Mutators for each field
Accessors for each field
totalAvailableBooks: returns the value of totalAvailableBooks
displayInfo: Prints the details of the book, including title, author, publication year, ISBN, availability, and price.
borrowBook: Sets the availability status to false if the book is available and decrements totalAvailableBooks; otherwise, prints a message indicating that the book is already borrowed.
returnBook: Sets the availability status to true if the book is currently not available, and increments totalAvailableBooks; otherwise, prints a message indicating that the book is already in the library.
calculateLateFeeint daysOverdue: Takes the number of days a book is overdue as a parameter and calculates the late fee. Assume a fixed late fee of $ per day overdue. Print a message indicating the late fee.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started