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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!