Question: c++ Library Class **You should have separate files for class definition and implementation: Library.h and Library.cpp Create a class Library, with separate interface and implementation,
c++
Library Class
**You should have separate files for class definition and implementation: Library.h and Library.cpp
Create a class Library, with separate interface and implementation, comprised of the following attributes:
| Data members (private): | |
| Book array: books | An array of Book objects |
| User array: users | An array of User objects |
| int: numBooks | Number of books in the database (library) |
| int: numUsers | Number of users in the database (library) |
| int: sizeBook | The capacity of the books array (200). Constant |
| int: sizeUser | The capacity of the users array (200). Constant |
|
|
|
| Member functions (public): | |
| Default constructor | Sets both numBooks and numUsers to value 0. |
| readBooks(string) | Takes a string (the name of the file to be read) and populates the books array. Returns the total number of books in books array as an integer |
| readRatings(string) | Takes a string (the name of the file to be read) and populates the users array. Returns the total number of users in users array as an integer |
| printAllBooks() | Prints all books stored in books array. |
| getCountReadBooks(string) | Takes a string (username) and returns the number of books read by that user as an integer. |
| calcAvgRating(string) | Takes a string (the title of a book) and returns the average rating of the specified book as a double |
| addUser(string) | Takes a string (username) and returns True if the username is successfully added to the database. Otherwise, returns False. |
| checkOutBook(string, string, int) | Takes two strings and an integer for username, title of book, and a new rating, respectively (in this order). Returns True if the rating is successfully updated. Otherwise, returns False. |
| viewRatings(string) | Takes a string (username) and prints all the books a user has provided ratings for. |
| getRecommendations(string | ) Takes a string username and prints the first 5 book recommendations from the most similar (other) user. |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
