This assignment is worth 40 points.
The library holds no more than 1000 books, and has no more than 50 readers. Your program should ensure that these conditions are enforced.
A book consists of the following:
A reader consists of a name. At any time the library might wish to know the if the reader has a book, and if so, what book, as well as the number of books and pages the reader has read excluding the current book.
The library wishes to allow the following actions
Note the statistics on the reader and the book do not change when the book is checked out.
Error: unknown reader name.
Error: unknown book title.
Error: title is already checked out.
Error: name already has a book.
Loaning title to name.
RETURN: this will allow a reader to return a book. This will remove the book from the reader and place it back in the library. The stats for both the reader and the library should be updated at this point.
Error: unknown book title.
Error: title has not been checked out.
name has returned title.
REPORT: produce a report on the reader.
Error: unknown reader name.
Dora Lindsay Books read: 1. Pages read: 1225. The current book is: Kidnapped. Alden Marquez Books read: 0. Pages read: 0.
Error: unknown book title.
War and Peace by Leo Tolstoy. Pages: 1225. Total Reads: 0. On loan to: Dora Lindsay. Kidnapped by Robert Louis Stevenson. Pages: 136. Total Reads: 1.
Error: unknown report type type.
There are bookcount books in the library. They are:
There are personcount people using the library. They are:
Executing PRINT BOOKS. There are 3 books in the library. They are: War and Peace by Leo Tolstoy. Pages: 1225. Total Reads: 2. Kidnapped by Robert Louis Stevenson. Pages: 136. Total Reads: 2. Watership Down by Richard Adams. Pages: 413. Total Reads: 1. Executing PRINT PEOPLE. There are 4 people using the library. They are: Dora Lindsay Books read: 3. Pages read: 1774. Alden Marquez Books read: 1. Pages read: 136. Ignacia Pace Books read: 1. Pages read: 1225. Hayes Schroeder Books read: 0. Pages read: 0.
The program should work as follows:
Enter the name of the configuration file =>
Opening filename.
do { cout << "Enter the name of the configuration file => "; cin >> name; cout << endl; cout << "Opening " << name << "." << endl; } while (not inFile);
books.dat names.dat commands.dat
War and Peace:Leo Tolstoy:1225 Kidnapped:Robert Louis Stevenson:136 Watership Down:Richard Adams:413
Reading books from fileName.
Error: can not add title to the library. It is full.
Error: unable to open the book file filename.
Dora Lindsay Alden Marquez Ignacia Pace Hayes Schroeder
Reading people from filename.
Error: unable to open reader file filename.
Error: reader list is full. Unable to add name.
Executing action.
Executing REPORT Alden Marquez.
PRINT BOOKS PRINT PEOPLE CHECKOUT War and Peace:Dora Lindsay REPORT Dora Lindsay STATS War and Peace RETURN War and Peace CHECKOUT Kidnapped:Dora Lindsay CHECKOUT Kidnapped:Alden Marquez REPORT Dora Lindsay REPORT Alden Marquez STATS Kidnapped RETURN Kidnapped REPORT Dora Lindsay REPORT Alden Marquez STATS Kidnapped CHECKOUT Watership Down:Dora Lindsay CHECKOUT Kidnapped:Alden Marquez CHECKOUT War and Peace:Ignacia Pace STATS Kidnapped STATS War and Peace STATS Watership Down RETURN Watership Down RETURN Kidnapped RETURN War and Peace REPORT Dora Lindsay REPORT Alden Marquez REPORT Ignacia Pace PRINT BOOKS PRINT PEOPLE
Error: unknown action action.
-g -O3 -Wpedantic -Wall -Wextra -Wmisleading-indentation -Wunused -Wuninitialized -Wshadow -Wconversion -std=c++17
To create tar file, follow the Working with the Tape Archive Utility (tar)