Question: Why is my code showing this on HyperGrade? What do I need to fix so it works? We have a file of books.csv that contains
Why is my code showing this on HyperGrade? What do I need to fix so it works? We have a file of books.csv that contains over books. And I have attached two example questions. public class Book
String isbn;
String title;
String author;
String genre;
int year;
String tags;
public BookString isbn, String title, String author, String genre, int year, String tags
this.isbn isbn;
this.title title;
this.author author;
this.genre genre;
this.year year;
this.tags tags;
public String toString
return title by author year Tags: String.join tags;
public boolean hasTagString tag
for String t : tags
if tequalsIgnoreCasetag
return true;
return false;
import java.util.Scanner;
import java.util.ArrayList;
import java.ioFile;
import java.util.List;
public class BookSearch
public static void mainString args throws Exception
List books loadBooksbookscsv;
Scanner scanner new ScannerSystemin;
System.out.printlnEnter tags separated by commas:;
String input scanner.nextLine;
String searchTags input.split;
for Book book : books
for String tag : searchTags
if bookhasTagtagtrim
System.out.printlnbook;
break;
public static List loadBooksString filename throws Exception
List books new ArrayList;
Scanner fileScanner new Scannernew Filefilename;
fileScanner.nextLine;
while fileScannerhasNextLine
String line fileScanner.nextLine;
String parts line.split;
String isbn parts;
String title parts;
String author parts;
String genre parts;
int year Integer.parseIntparts;
String tags partssplit;;
books.addnew Bookisbn title, author, genre, year, tags;
fileScanner.close;
return books;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
