Question: Book ( title: String, author: String, book _ copies: int ) : Constructor that initializes the book's title, author, and the total number of copies.

Book(title: String, author: String, book_copies: int): Constructor that initializes the book's title, author, and the total number of copies. It should also set the available copies initially to the same value as the total copies. This method should also update the static variable: total_available_books by adding the book_copies to it.
2- In Book Class, Write the code for the method get_borrowed_copies
get_borrowed_copies () : Returns the number of borrowed copies.
3- In Book Class, Write the code for the method borrow: The method decrements the available_copies by 1 if it is greater than 0. This method should also update the static variable: total_available_books after borrowing one book [1.5 pt].
4- In the Main Class
a.[1 pt] Create 2 Book objects as the following:
\table[[title,author,book_copies],[Intro to Java,Ahmed Khalid,10],[Data Structure,Tom John,8]]
b.[1 pt] Borrow 2 books from the first book "Into to Java".
c.[1 pt] Print the title, author, book_copies, and available_copies of the first book.
d.[0.5 pt] Print the total_books.
 Book(title: String, author: String, book_copies: int): Constructor that initializes the book's

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!