05 December 2011

5 December 2011: This Week's Plan

Tuesday: we have to have chapter 13 done by the end of Tuesday. Jes will also have the PowerPoint ready for review.

Wednesday: chapter 14 must be in working condition. Phil, tidy up the code (add comments, remove unnecessary comments, format the code, and perform test cases). Kevin, have the website ready for presentation.

Thursday: presentation. We should rehearse before class begins and perform final checks before our presentation. We will introduce ourselves, talk about how we started the project (organization, communication, et cetera), and then we will go in-depth about the details of the project (all of this will be outlined in the PowerPoint).

04 December 2011

4 December 2011 Schedule Update

Monday @ 6:30 p.m. - business building
Tuesday @ 3:45 p.m. -TMARC (Jes and Phil)
Wednesday @ 4:30 p.m. -TMARC (Kevin and Jes)
Tidy up code - Phil (finish by Wednesday)
PowerPoint - Jes (finish by Tuesday)
Website- Kevin (finish by Wednesday)

20 November 2011

P.L. Ch 10 update

ch10 is complete. All files compile and are in sync with the current program. All updated files have been uploaded to the master account. One suggestion is to add more bookdata objects into the bookdata array. This way, we can thoroughly test new features.

18 November 2011

Update for Ch10

I just completed up to part 2.
Part 3 should be finished by Friday, and it is not difficult.
Just a little bit of tedious work with for loops and sorting bookdata object's attributes in order (i.e. highest qty to lowest qty. or oldest date added to earliest date added).

The current program compiles with all chapters incorporated up til ten. I will upload it to the master account as soon as ch 10 is complete.
-P.L.

17 November 2011

Assignment Update

-Chapter 8 status: done
-Chapter 9 status: done (check for errors)
-P.L. finish Chapter 10 by Saturday and start Chapter 13
-K.C. start Chapter 12
-J.Y. start Chapter 11

Update 1

-organized pseudocode
-synchronized files (check master account for "sync_1")
-fixed a majority of the bugs, but check for logic errors

Chapter 8

-setTitle, accept string, copy to bookTitle member
-setIsbn, accept string, copy to isbn member
-setAuthor, accept string, copy to publisher member
-setPub, accept string, copy to publisher member
-setDateAdded, accept string, copy to dateAdded member
-setQty, accept int, copy to qtyOnHand member
-setWholesale, accept double, copy to wholesale member
-setRetail, accept double, copy to retail member
-isEmpty, return value in empty member
-insertBook, set empty member to false
-removeBook, set empty member to true
-getTitle, return value in bookTitle member
-getIsbn, return value in isbn member
-getAuthor, return value in author member
-getPub, return value in publisher member
-getDateAdded, return value in dateAdded member
-getQty, return value in qtyOnHand member
-getWholesale, return value in wholesale member
-getRetail, return value in retail member

-in mainmenu.cpp, define an array of 20 BookData class objects
-In Chapter 13, program will be modified to store the book data in a separate file

Chapter 9

1) findBook Function
    • Function prototype declared in invmenu.h as:
    int findBook(BookData b[], string name) //invmenu.h
    • A for loop with index less than 20 will be used to search the array of
    BookData objects and the string compare function will be used to match
    name with isbn and bookTitle. Returns book index if compare is true
    and -1 if it fails to find the same string in the array.

2) addBook Function
    • This function will be modified such that its prototype reads:
    int addBook(BookData b[]) //invmenu.h
    • A for loop with index less than 20 is used to check through the array
    of objects.  This loop will search for an empty string in each element's
    title.  Using if/else: (else) If no such element if found, then cout statement
    is outputted ("Inventory Full.\n").  (if != -1) If empty element is found then element
    kept and user is prompted for bookTitle, isbn, publisher, dateAdded,
    quantity, wholesale, and retail.  These are input into corresponding data
    members in the object using corresponding setter functions.
  
3)    lookUpBook Function
    • This function will be modified such that the prototype reads:
    int lookUpBook(BookData b[]) //invmenu.h
    • User is prompted for isbn or bookTitle. findBook function
    is called, passing b[] and the string.  Using if/else: (if != -1) call
    bookInfo passing appropriate object (else) cout ("Book not in Inventory.\n")

4)    editBook Function
    • This function will be modified such that its prototype reads:
    int editBook(Bookdata b[]) // invmenu.h
    • User is prompted for isbn or bookTitle.  The findBook function
    is called, passing b[] and the string.  Using if/else: (if != -1) bookInfo
    is called passing located object; using a While(while answer == "yes")
    the user is then asked for one field at a time to change; appropriate data
    type is changed to user's specifications.  (else) cout ("Book not in Inventory.\n")

5)    deleteBook
    • This function will be modified such that its prototype reads:
    in deleteBook(Bookdata b[]) // invmenu.h
    • User is prompted for for isbn or bookTitle. findBook function
    is called, passing b[] and the string.  Using if/else: (if != -1) call
    bookInfo passing located object;  User is prompted to verify book (yes/no)
    if yes, destructor is called to delete object element else back to menu.
    (else) cout ("Book not in Inventory.\n")

Chapter 10

1. Allow Multiple Transactions (cashier.cpp)
  • Use a while loop to prompt for multiple purchases.
  • Use if statement to proceed with purchase.
  • Use else statement to end loop.

2. Enable Automatic Lookup (cashier.cpp)
  • Use for loop with if statement to find book by ISBN in bookdata array.
  • Print information with cashier print function.
  • If no ISBN is found, prompt input error and prompt if user would like input again.
  • Once purchase information has been retrieved, check quantity for enough copies, if enough copies, deduct from stock, else output error.

3. Complete the stub functions (reports.cpp)
  • The "repListing" function uses for loop to print out all books including: title, ISBN number,author, publisher, date added to inventory, quantity on hand, wholesale cost, and retail price, print report title, and then allows user to hit any key to continue.
  • The "repWholesale" function uses for loop to print out all books including: title, ISBN number, quantity on hand, and wholesale cost, print report title, then allows user to hit any key to continue, and then display the total wholesale value of all the books in stock.
  • The "repRetail" function uses for loop to print out all books including: title, ISBN number, quantity on hand, and retail price, print report title, then allows user to hit any key to continue, and then display the total retail value of all the books in stock.
  • The "repQty" function uses for loop to print out all books including: title, ISBN number, and quantity on hand, use bubble sort to display quantity in descending order, print report title, and then allows user to hit any key to continue.
  • The "repCost" function uses for loop to print out all books including: title, ISBN number, quantity on hand, and wholesale cost, use bubble sort to display wholesale cost in descending order, print report title, and then allows user to hit any key to continue.
  • The "repAge" function uses for loop to print out all books including: title, ISBN number, quantity on hand, and date added to the inventory, use bubble sort to display date added in descending order, print report title, and then allows user to hit any key to continue.

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?

Chapter 12

    • #include<cctype> is declared above.
    • function prototype: string up(string s)
    is declared
    • This function uses for loop with index < s.size() and uses
    toupper(s[i]) to convert string to upper case and returns a modified version
    of the string to be used by functions below
   
1)    match Function
    • void match(string title, vector<unsigned int>&found)
    prototype is added to BookCollection class as a member function
    • for loop with index < s.size() is used. Inside the loop
    if (up(title) == up(book.title[i])) assign i into found vector.

2)    partialMatch Function
    • void partialMatch(string title, vector<unsigned int>&found)
    prototype is added to BookCollection class as a member function.
    • Declare s1 = up(title).  Then for loop with index < s.size() is used.
    Inside the loop    declare string s2 = up(book.title[i]);
    if (s2.find(s1) != string::npos) assign i into found vector.

3)    displayBooks Function
    • void displayBooks(vector<unsigned int>&)
    prototype is added to BookCollection class as a member function.
    • for loop with index < found size is used. Each index in the found
    vector uses book[] display function.

4)    lookUpBook now calls the above functions sequentially.

Chapter 13

  • Create "Serendipity.data".
  • Add function: void load(fstream &); void store(fstream &); as member functions in BookData.cpp.
  • Load Serendipity.data from BookCollection constructor into Bookdata object array inside BookCollection object. 
  • Output current data into Serendipity.data from BookCollection destructor.

11 November 2011

First Group Meeting

-Divided pseudocode
-K.C. assigned chapters 9 and 12
-P.L. assigned chapters 10 and 13
-J.Y. assigned chapters 8 and 11
-Chapter 14 will be done together
-Created website


BE SURE TO SYNCHRONIZE FILES EVERY THURSDAY