- Part 1 30 Pts A Text File Books Txt Has Lines That Contain Information About Books Examine The Books Txt File Sample 1 (46.66 KiB) Viewed 39 times
Part 1: 30 pts A text file books.txt has lines that contain information about books. Examine the books.txt file. Sample
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Part 1: 30 pts A text file books.txt has lines that contain information about books. Examine the books.txt file. Sample
Part 1: 30 pts A text file books.txt has lines that contain information about books. Examine the books.txt file. Sample lines from file: The Alchemist;Paulo Coelho,1988,163 Dune;Frank Herbert;1965;412 Write a Java static method readBooks() that takes a file name as parameter, and reads the lines of the file, create Book objects, store these objects in an ArrayList of books, and returns this ArrayList. Write a Java static method printBooks() that takes an ArrayList of books as parameter, and prints the book objects in this ArrayList. Write Java statements that calls readBooks() method to create an ArrayList of book objects, then print the books in the ArrayList by calling printBooks() method as seen in the sample run below. Part 2: 20 pts Write a Java static method findBooks() that takes an ArrayList of book objects and a string (containing part of author name) as parameters, and prints the book objects containg the 2nd parameter in the author attribute. Hint: You may use String method indexOf() to check if a string (the author of a book object from ArrayList) contains another string (the 2nd parameter). Write Java statements that inputs a string entered by user, and print the books that contain the entered string in author attribute in the ArrayList th by calling printBooks() method. 1