Question
Write a function that, given a users name and a books title, returns the rating that the user gave for that book. Your function MUST
Write a function that, given a users name and a books title, returns the rating that the user gave for that book.
-
Your function MUST be named getRating.
-
Your function should take 6 input arguments in the following order:
-
string: username
-
string: title of the book
-
Array of User objects: users
-
Array of Book objects: books
-
int: number of users currently stored in the users array
-
int: number of books currently stored the books array
-
-
The username and book 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:
-
Return the rating value if both user and title are found
-
Return -3 if the user or the title are not found
-
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started