// Name : Matthew Reeves // This is a program to create inventory for books //creates BookInventory class public class BookInventory { //initializes instance variables private Book theBook; private int count; //constructor, initializes Book object to values passedin, and count to 0 public BookInventory(Book abook) { count=0; theBook=abook; } //addBook method validates number of book to add to inv, and updates inventory public boolean addBook (int amount) { if (amount>=0) { count+=amount; return true; } else { return false; } } //removeBook method validates number of book to remove from inv, and updates inventory public boolean removeBook (int amount) { if (amount>=0 && amount<=count) { count-=amount; return true; } else { return false; } } //allows count value to be easily retrieved public int getCount() { return count; } //returns a formatted string with book attributesm and number of books in inventory public String toString() { return String.format("%sNumber in inventory:\t %d",theBook.toString(),getCount()); } }