void Utils::displayBookInformation(Book book) { cout << "\tISBN \t" << book.getIsbn() << endl; cout << "\tTitle \t" << book.getTitle() << endl; cout << "\tAuthor \t" << book.getAuthor() << endl; cout << "\tPublisher \t" << book.getPublisher() << endl; cout << "\tDate Added \t" << toString(book.getDateAdded()) << endl; cout << "\tQuantity-On-Hand\t" << book.getQuantityOnHand() << endl; cout << "\tWholesale Cost \t" << setprecision(2) << book.getWholesaleCost() << endl; cout << "\tRetail Price \t" << setprecision(2) << book.getRetailPrice() << endl << endl; }
/* Converts a Book object to string representation Example: 1 ISBN: 0399257748 Title: The Martian Author: Andy Weir Publisher: Scribner Date Added: 2015-1-16 23:56:11 Quantity: 1 */ string Utils::toString(int itemNumber, int quantity, Book book) { string bookString = ""; bookString += to_string(itemNumber) + "\n"; bookString += "\t ISBN: " + book.getIsbn() + "\n"; bookString += "\t Title: " + book.getTitle() + "\n"; bookString += "\t Author: " + book.getAuthor() + "\n"; bookString += "\t Publisher: " + book.getPublisher() + "\n"; bookString += "\t Date Added: " + toString(book.getDateAdded()) + "\n"; bookString += "\t Quantity: " + to_string(quantity) + "\n"; ostringstream stream; stream << fixed << setprecision(2) << book.getRetailPrice(); bookString += "\t Retail Price: " + stream.str() + "\n"; return bookString; }