Question: BookData Define a class BookData that keeps track of information for a book and how it is rated by customers (real numbers between 0.0 and
BookData
Define a class BookData that keeps track of information for a book and how it is rated by customers (real numbers between 0.0 and 5.0). The class has the following public methods:
BookData(title, author) -- constructs a BookData object with the given title and author
review(rating) -- records a review for the book with given rating
getTitle() -- returns the title of the book
getRating() -- returns the average of all ratings (0.0 if none)
getNumReviews() -- returns the number of reviews the book has received
toString() -- returns a String with title, author, average rating, and number of reviews

The program should be written in Java.
Below is an example for a book that has been reviewed four times: BookData book = new BookData("1984", "George Orwell"); book. review (4.7); book.review (5); book.review(4.9); book. review (4.9); After these calls, the call book.getRating() would return 4.875 (the average of the ratings). The toString method should return a string of the form:
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
