Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a Library class. Include vectors of Books and patrons. Include a struct c

ID: 3773103 • Letter: C

Question

Create a Library class. Include vectors of Books and patrons. Include a struct called Transaction. Have it include a Book, a Patron, and a Date from the chapter. Make a vector of Transactions. Create functions o books to the library, add patrons to the library, and check out books. Whenever a user checks out a book, have the library make sure that both the user and the book are in the library. If they aren't, report an error. Then check to make sure that the user owes no fees. If the user does, report an error. If not, create a Transaction, and place it in the vector of Transactions. Also write a function that will return a vector that contains the names of all Patrons who owe fees.

Explanation / Answer

Answer:

class Library

{

public:

      void add_bookOf(Book1);

      void add_patronOf(Patron1);

      void book_outOf(Book1, Patron1);

      struct Transaction1

      {

            Transaction1(Book1, Patron1, Date1);

            Book1 bookOf;

            Patron1 patronOf;

            Date1 dateOf;

      };               

private:

      vector transact;

      vector booksVal;

      vector patronsVal;

};