Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello! I need help to solve problem number 8. I included a screenshot of the instructions. I also included a screenshot of the coderunner instructions

Hello! I need help to solve problem number 8. I included a screenshot of the instructions. I also included a screenshot of the coderunner instructions that checks our code. It's really important you follow both screenshot of the instructions. The coderunner checks everything specifically so please pay careful attention to the instructions. Also please include comments that explains what you're doing. I really want to learn this but I'm struggling at the moment. God bless and thank you for your work!

image text in transcribedimage text in transcribed

image text in transcribed

These are the coderunner instructions. They're essentially the same, just more useful information.

image text in transcribed

image text in transcribed

EDIT: One of the test cases includes a mix of uppercase and lower case, so the code should be case insensitive.

Problem 8 (25 points) getRating We now have a list of usernames and a list of ratings. Now, we want to search for a particular user's rating for a particular book title. Write a function that, given a user's name and a book's title, returns the rating that the user gave for that book. Your function MUST be named getRating Your function should take 7 input arguments in the following order: . . o string: username o string: title of the book Array of string: users o 2-Dimensional int array: ratings - list of ratings for each user lassume it o int: number of users whose names/ratings are currently stored in the string o int: number of books whose titles/ratings are currently stored in the string Array of string: titles has 100 rows and 50 columns] array/2D array respectively arrayl2D array respectively . The username and title search should be case insensitive. "Ben, "ben" and "BEN" are one and the same user should return the user's rating value for that book title . The function should return the following values depending on cases: Return the rating value if both user and title are found Return -3 if the user or the title are not found o o Value of users string users [2] {"User1", "User2"); = Value of titles string titles [3]-("Titlel", "Title2", "Title3"); Value of ratings int ratings [21 131,4,2), 10,5,3) ; Example 1: Both the userName and bookTitle exists, and the value of rating is non-zero Function call getRating ("Userl", "Title2", users, titles, ratings, 2, 3); Return value Example 2: The userName does not exist, it returns 3 Function call getRating ("User4", "Title1", users, titles, ratings, 2, 3); Return value Example 3: The bookTitle does not exist, it returns - 3 Function call getRating ("Userl", ratings, 2, 3); "Title10", users, titles, Return value Example 4: The userName and the bookTitle do not exist Function call "Title10", titles, getRating ("User12", ratings, 2, 3); users, Return value In Cloud9 the file should be called getRating.cpp and it will be one of 9 files you need to zip together for the Homework 6 (File Submission) on Moodle. After developing in Cloud9, this function will be one of the functions needed at the top of HW6.cpp Don't forget to head over to Moodle to the link Homework 6 CodeRunner. For Problem 8, in the Answer Box, paste only your function definition, not the entire program. Press the Check button. You can modify your code and re-submit (press Check again) as many times as you need to We now have a list of usernames and a list of ratings. Now, we want to search for a particular users rating for a particular book title. Write a function that, given a user's name and a book's title, returns the rating that the user gave for thait book. Your function MUST be named getRating. Your function should take 7 input arguments in the following order: string: username o string: title of the book Array of strings: users Array of strings: titles o 2-Dimensional int array: ratings- list of ratings for each user [assume it has 100 rows and 50 columns] o int: number of users whose names/ratings are currently stored in the string array/2D array respectively int: number of books whose titles/ratings are currently stored in the string array/2D array respectively The username and title search should be case insensitive. "Ben, "ben" and "BEN" are one and the same user If both the user name and the book title are found in the arrays, then the function should return the users rating value for that book title. The function should return the following values depending on cases o Return the rating value if both user and title are found o Return -3 if the user or the title are not found o Return -3 if the user or the title are not found Value of users string users[2] "User1", "User2"%; Value of titles string titles[3] ['Title1", "Title2", "Title3") Value of ratings int ratings[21131 1,4,2),10,5,3)); Example: Both the userName and bookTitle exists, and the value of rating is non-zero Function cal getRating( User1", "Title2", users, titles, ratings, 2, 3); Return value 4 Example 2: The userName does not exist, it returns -3 Function call getRating("User4", "Title1", users, titles, ratings, 2, 3) Return value -3 Example 3: The bookTitle does not exist, it returns - 3 Function call Return value getRating("User1", "Title10", users, titles, ratings, 2, 3); -3 Example 4: The userName and the bookTitle do not exist Function call getRating("User12", "Title10", users, titles, ratings, 2, 3); Return value -3 Problem 8 (25 points) getRating We now have a list of usernames and a list of ratings. Now, we want to search for a particular user's rating for a particular book title. Write a function that, given a user's name and a book's title, returns the rating that the user gave for that book. Your function MUST be named getRating Your function should take 7 input arguments in the following order: . . o string: username o string: title of the book Array of string: users o 2-Dimensional int array: ratings - list of ratings for each user lassume it o int: number of users whose names/ratings are currently stored in the string o int: number of books whose titles/ratings are currently stored in the string Array of string: titles has 100 rows and 50 columns] array/2D array respectively arrayl2D array respectively . The username and title search should be case insensitive. "Ben, "ben" and "BEN" are one and the same user should return the user's rating value for that book title . The function should return the following values depending on cases: Return the rating value if both user and title are found Return -3 if the user or the title are not found o o Value of users string users [2] {"User1", "User2"); = Value of titles string titles [3]-("Titlel", "Title2", "Title3"); Value of ratings int ratings [21 131,4,2), 10,5,3) ; Example 1: Both the userName and bookTitle exists, and the value of rating is non-zero Function call getRating ("Userl", "Title2", users, titles, ratings, 2, 3); Return value Example 2: The userName does not exist, it returns 3 Function call getRating ("User4", "Title1", users, titles, ratings, 2, 3); Return value Example 3: The bookTitle does not exist, it returns - 3 Function call getRating ("Userl", ratings, 2, 3); "Title10", users, titles, Return value Example 4: The userName and the bookTitle do not exist Function call "Title10", titles, getRating ("User12", ratings, 2, 3); users, Return value In Cloud9 the file should be called getRating.cpp and it will be one of 9 files you need to zip together for the Homework 6 (File Submission) on Moodle. After developing in Cloud9, this function will be one of the functions needed at the top of HW6.cpp Don't forget to head over to Moodle to the link Homework 6 CodeRunner. For Problem 8, in the Answer Box, paste only your function definition, not the entire program. Press the Check button. You can modify your code and re-submit (press Check again) as many times as you need to We now have a list of usernames and a list of ratings. Now, we want to search for a particular users rating for a particular book title. Write a function that, given a user's name and a book's title, returns the rating that the user gave for thait book. Your function MUST be named getRating. Your function should take 7 input arguments in the following order: string: username o string: title of the book Array of strings: users Array of strings: titles o 2-Dimensional int array: ratings- list of ratings for each user [assume it has 100 rows and 50 columns] o int: number of users whose names/ratings are currently stored in the string array/2D array respectively int: number of books whose titles/ratings are currently stored in the string array/2D array respectively The username and title search should be case insensitive. "Ben, "ben" and "BEN" are one and the same user If both the user name and the book title are found in the arrays, then the function should return the users rating value for that book title. The function should return the following values depending on cases o Return the rating value if both user and title are found o Return -3 if the user or the title are not found o Return -3 if the user or the title are not found Value of users string users[2] "User1", "User2"%; Value of titles string titles[3] ['Title1", "Title2", "Title3") Value of ratings int ratings[21131 1,4,2),10,5,3)); Example: Both the userName and bookTitle exists, and the value of rating is non-zero Function cal getRating( User1", "Title2", users, titles, ratings, 2, 3); Return value 4 Example 2: The userName does not exist, it returns -3 Function call getRating("User4", "Title1", users, titles, ratings, 2, 3) Return value -3 Example 3: The bookTitle does not exist, it returns - 3 Function call Return value getRating("User1", "Title10", users, titles, ratings, 2, 3); -3 Example 4: The userName and the bookTitle do not exist Function call getRating("User12", "Title10", users, titles, ratings, 2, 3); Return value -3

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

Principles Of Database Systems With Internet And Java Applications

Authors: Greg Riccardi

1st Edition

020161247X, 978-0201612479

More Books

Students also viewed these Databases questions

Question

What are negative messages? (Objective 1)

Answered: 1 week ago