Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This problem is done using Python! Write a Library class such that libraryDriver.cpp can make use of functions in the Library class to create a

This problem is done using Python!

Write a Library class such that libraryDriver.cpp can make use of functions in the Library class to create a book recommendation system.

The Library class should have the following:

Instance variables

? book_list : list to store the books read from file.

? user_dictionary: a python dictionary which stores the users and their ratings for the books.

Class methods:

? constructor: provide a constructor that takes two filenames (books_filename, ratings_filename) as parameters and creates the required dictionaries and lists as class data members.

? read_books(file_name) method should add entries to a member list variable for books from the file.

? read_users(user_file_name) method should add entries to a member dictionary variable for ratings from the file.

You will also provide other methods as described below to provide the recommendations of books to read for a given user.

1. Load book data and user data from text files. After the data is loaded, print the following:

Data Loaded successfully!

2. a) Login. (There are no passwords. Anyone can log in as anyone else simply by providing their name.) After the data is loaded, welcome the user to the library and ask them to enter their name. If a user has interacted with the system before, the system should remember the user's previous ratings. 2. b) Add new user.

If it is a user's first time interacting with the system, they should be added to the list of users.

After welcoming the user, present the user with 4 choices:

1. View your ratings

2. Rate a book

3. Get book recommendations

4. Quit

The user is asked to choose one of the menu options by entering one character for each option: v, r, g, q

3. View all your own ratings. A user should be able to see all the books they have provided ratings for. Recall that a rating of 0 means a user has not rated that book and hence shouldnt be displayed. 4. Rate a book. A user should be able to rate books. If the user chooses to rate a book, the user will be prompted first to enter the title of the book along with the rating. If the title of the book does not exist in the system, then the user will be prompted to enter a new title. Even if the user has already rated a book, they should be able to enter a new rating value. 5. See recommended books.

To generate recommendations for a user, for example the user named ben:

Find the most similar user to ben. Lets say we found claire to be most similar .

Find at most 10 books claire has rated with a rating of 3 or 5 that ben has not yet read (rating 0)

If there are less than 10 books to recommend, recommend as many as possible. Ben will be presented with 0 to 10 recommendations.

6. Quit.

Print "Goodbye!" and terminate the execution of the program

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions

Question

1. What are the peculiarities of viruses ?

Answered: 1 week ago

Question

Describe the menstrual cycle in a woman.

Answered: 1 week ago

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago