// CSE 00au HW3 Starter header file. // // Inventory.h - header file for Inventory class // #ifndef INVENTORY_H #define INVENTORY_H #include "BookInfo.h" // // This class is used to hold a list of book. There is no maximum // number of books. // class Inventory { public: // construct an empty inventory that can hold 4 books Inventory(); // free any memory held by this inventory ~Inventory(); // return the number of books in this Inventory list. int numBooks() const; // store in b information about the i'th book in the list. // if there is no such book, store in b a BookInfo object // with book_genre ERROR and 0 copies. void getBook(int i, BookInfo &b); // Inserts a copy of book b into this list. Returns true if successful, false // if unable to allocate enough memory to hold the modified list with b added bool insert(const BookInfo b); // Update this Inventory to reflect a sale of n copies of the book // with the given title. Return the number of copies of t // remaining, and remove the book from this Inventory if the last // copies were sold. If num is greater than the number of copies // available, sell all copies. int sell(const int num, const string title); // Copy all books by given author to subinventory void author_search(const string &author, Inventory &subinv); // Copy all books with given genre to subinventory void genre_search(book_genre genre, Inventory &subinv); // return information for the book with given title. If there is no such // book in stock, return a BookInfo entry with a null string in the title BookInfo title_search(string title); // sort the books by author then by title void sort(); // print all book entries to cout in their current order in this Inventory void print(); private: ///////////////////////////////////////////////////////////////// /// /// Define all the private data (and methods) here as needed. /// ///////////////////////////////////////////////////////////////// }; #endif