Exemple #1
0
void Library::check_out_book(const chrono::Date& d,const Patron& p,Book& b)
{
  if(!book_exists(b) || !patron_exists(p))
    {
      throw std::runtime_error("patron or book doesnt exist");
    }

  if(p.has_fee())
    {
      throw std::runtime_error("patron has a fee: " + p.amount_fees_owed());
    }

  transactions.push_back(Transactions(d,p,b));
  b.check_out();
}