//Same as above. Uses viewBookInfo to print books checked out to a patron. void Library::viewPatronInfo(std::string patronID) { Patron* patron = GetPatron(patronID); if(patron == NULL) { std::cout << std::endl << "That patron does not exist!" << std::endl; } else { std::cout << std::endl << "Patron ID: " << patron->getIdNum() << std::endl; std::cout << "Name: " << patron->getName() << std::endl; std::cout << "Fines: $" << std::setprecision(2) << std::fixed << patron->getFineAmount() << std::endl; if(patron->getCheckedOutBooks().size() == 0) { std::cout << "No checked out books." << std::endl << std::endl; } else { std::cout << "Checked out books:" << std::endl << std::endl; for(int i = 0; i < patron->getCheckedOutBooks().size(); i++) { viewBookInfo(patron->getCheckedOutBooks().at(i)->getIdCode()); } std::cout << std::endl << std::endl; } } }
void Library::listAllBooks() { /* * An extremely useful function for debugging, also much faster than * typing in single-book information even when you only want to look * at a single book * * Does just what it says */ std::cout << std::endl << "Showing all books in the library:" << std::endl; for (int i=0; i < holdings.size(); i++) viewBookInfo(holdings[i].getIdCode()); }