17 November 2011

Chapter 11

-bookInfo function will be made a member of BookData class
-BookData::bookInfo();
-new BookCollection class

class BookCollection
{
    static const int MAX_BOOKS = 20;
    BookData book[MAX_BOOKS]; // array of BookData objects
    int findBook(string);
public:
    // From chapter 9
    void addBook();
    void deleteBook();
    void editBook();
    void lookUpBook();
    int lookupIsbn(string isbn);
    void displayIsbn();
    bool booksAvailable();
    BookData & operator[ ](int i) { return book[i]; }
    // Reporting functions from chapter 10
    void repListing();
    void repWholesale();
    void repRetail();
    void repQty();
    void repCost();
    void repAge();
};

-booksAvailable() function determines if there are any books in the collection
-if true, return true, else, return false
-include BookData.h in BookCollection.h

-new menu class
-includes cashier(), invMenu(), and reports() functions
-directly or indirectly refer to BookCollection object = pointer

class Menu
{
private:
    // Pointer to a bookCollection object
    static BookCollection *books;
public:
    static void cashier();
    static void invMenu();
    static void reports();
    // this function will be called to initialize the Menu
    // After the book collection object has been created
    static initialize(BookCollection *b){ books = b; }
};

-include BookCollection.h in mainmenu.h
-Implement the member functions of all three classes by modifying already implemented
functions to become members of these classes?