Time To Code
Explore practical Java programming by analyzing Amazon's Top 50 Bestselling Books dataset. Learn to code functions that count books by authors, list unique authors, retrieve book titles, filter by user ratings, and extract pricing details, enhancing your ability to manipulate and analyze real data using Java.
Task I: Total number of books by an author
Our task is to find the total number of books written by specific authors.
✏️ Note: Below is the same code we saw in the previous lesson to read the dataset as objects of book class. Write the piece of code to answer the questions below.
It takes the name of an author and dataset as input and returns the total number of books written by the author.
Input: J.K. Rowling
Expected output:
Total number of books by J.K. Rowling: 6
Just for reference, Author is the second column in the dataset.
If you’re unsure how to do this, click the “Show Hint” button.
Task II: All the authors in the dataset
Our task is to find the names of all the authors present in the dataset. Remember: many records may have the same author, so don’t consider the same author multiple times.
Expected output: List name of all authors in the dataset.
Just for reference, Author is the second column in the dataset.