Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You were given two text files with comma separated values: books.txt, which is a list of books and their authors, and ratings.txt, which is a

You were given two text files with comma separated values: books.txt, which is a list of books and their authors, and ratings.txt, which is a list of users and their ratings of those books.

Write a function getUserReadCount for determining how many books a particular user has read and reviewed. This function should:

Accept five arguments in this order: string: username for whom we want a read count string array: all users 2D int array: list of all ratings, one row for each user int: number of users in the arrays int: number of books accounted for in the 2D array

Return the number of books read/reviewed by the specified user, as an integer.

int getUserReadCount(string username, string allUsers[], int ratings[][50], int users, int counts){ }

If the program has not read ratings.txt or books.txt, it must read it first before executing this function. In this case, return -1 after printing the following message: cout << name << " does not exist in the database" << endl;

If instead the database is initialized but the user is not found, return -1 after printing the following message : cout << name << " does not exist in the database" << endl;

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

Students also viewed these Databases questions

Question

Explain the principles of delegation

Answered: 1 week ago

Question

State the importance of motivation

Answered: 1 week ago

Question

Discuss the various steps involved in the process of planning

Answered: 1 week ago

Question

What are the challenges associated with tunneling in urban areas?

Answered: 1 week ago

Question

What are the main differences between rigid and flexible pavements?

Answered: 1 week ago