My problem is my code does not recognize the file path.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

 My problem is my code does not recognize the file path.

 
CODE:
 

Author.java

package libraryDatabase; import java.util.Objects; public class Author { String firstName; public Author() { } String LastName; public Author(String firstName, String lastName) { this.firstName = firstName; LastName = lastName; } @java.lang.Override public java.lang.String toString() { return "Author{" + "firstName='" + firstName + '\'' + ", LastName='" + LastName + '\'' + '}'; } //this will be used for comparing two authors @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Author author = (Author) o; return Objects.equals(firstName, author.firstName) && Objects.equals(LastName, author.LastName); } //this will be used when we compare two authors in search method @Override public int hashCode() { return Objects.hash(firstName, LastName); } }

 

Book.java

package libraryDatabase; public class Book { Author author; String title; int year; String publisher; String genre; double rating; double price; public Book() { } public Book(Author author, String title, int year, String publisher, String genre, double rating, double price) { this.author = author; this.title = title; this.year = year; this.publisher = publisher; this.genre = genre; this.rating = rating; this.price = price; } @Override public String toString() { return "Book{" + "author=" + author + ", title='" + title + '\'' + ", year=" + year + ", publisher='" + publisher + '\'' + ", genre='" + genre + '\'' + ", rating=" + rating + ", price=" + price + '}' + '\n'; } }

 

BookDatabase.java

package libraryDatabase; import java.util.ArrayList; public class BookDatabase { private final ArrayList<Book> books; //if no books provided adding empty list public BookDatabase() { this.books = new ArrayList<>(); } //intialising with given books public BookDatabase(ArrayList<Book> books) { this.books = books; } public void addBook(Book book) { this.books.add(book); } public void removeBook(Book book) { this.books.remove(book); } public ArrayList<Book> search(Author author) { ArrayList<Book> result = new ArrayList<>(); //for every book we compare with author provided // if equal store it in result and return for (Book book : books) { //this equals method is written in author class if (book.author.equals(author)) { result.add(book); } } return result; } public ArrayList<Book> search(int startYear, int endYear) { ArrayList<Book> result = new ArrayList<>(); for (Book book : books) { if (book.year >= startYear && book.year <= endYear) { result.add(book); } } return result; } public ArrayList<Book> search(String genre) { ArrayList<Book> result = new ArrayList<>(); for (Book book : books) { //it's a string equals method if (book.genre.equals(genre)) { result.add(book); } } return result; } @Override public String toString() { return "BookDatabase{" + "books=" + books.toString() + '}'; } }

 

Client.java

package libraryDatabase; import java.io.*; import java.util.ArrayList; public class Client { private static final String delimiter = ","; public static void main(String[] args) { try { //Declaring and initialising file Readers ArrayList<Book> books = new ArrayList<>(); File file = new File("dataset.csv"); FileReader fr = new FileReader(file); BufferedReader br = new BufferedReader(fr); String line; String[] columns; int i = 0; //reading everyLine in csv file while ((line = br.readLine()) != null) { //splitting the row and storing values in array; columns = line.split(delimiter); if (i == 0) { //skipping header in csv i = 1; continue; } //for every row adding reading its column values and creating book.author //objects and adding it to books //reading column values String firstName = columns[0]; String lastName = columns[1]; String title = columns[2]; int year = Integer.parseInt(columns[3]); String publisher = columns[4]; String genre = columns[5]; double rating = Double.parseDouble(columns[6]); double price = Double.parseDouble(columns[7]); //creating author and book objects Author author = new Author(firstName, lastName); Book book = new Book(author, title, year, publisher, genre, rating, price); //adding book to books books.add(book); } //creating bookDatabase BookDatabase bookDatabase = new BookDatabase(books); //searching with genre System.out.println("genre books Data"); ArrayList<Book> booksWithGenre = bookDatabase.search("Anthologies "); System.out.println(booksWithGenre.toString()); //searching with years System.out.println("Books in Range"); ArrayList<Book> booksInGivenRange = bookDatabase.search(1999, 2010); System.out.println(booksInGivenRange.toString()); //searching with author System.out.println("Books with Author"); ArrayList<Book> booksWithAuthor = bookDatabase.search(new Author("Yvonne", "Vera")); System.out.println(booksWithAuthor); br.close(); } catch (IOException ioe) { ioe.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } }
 
 
 
 
 
■x* 最晶
<terminated> Client [Java Application] /Users/fallonwarnick/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jr
java.io.FileNotFoundException: dataset.csv (No such file or directory)
at java.base/java.io.FileInputStream.open0 (Native Method)
at java.base/java.io.FileInputStream.open (FileInputStream.java:216)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
at java.base/java.io.FileReader.<init>(FileReader.java:75)
at Library.Client.main(Client.java:19)
Transcribed Image Text:■x* 最晶 <terminated> Client [Java Application] /Users/fallonwarnick/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jr java.io.FileNotFoundException: dataset.csv (No such file or directory) at java.base/java.io.FileInputStream.open0 (Native Method) at java.base/java.io.FileInputStream.open (FileInputStream.java:216) at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157) at java.base/java.io.FileReader.<init>(FileReader.java:75) at Library.Client.main(Client.java:19)
Filter
Select
1
first name
last name
title
2 Yvonne
3 None
4 Roger D. Abrahams African Folktales
5 Vincent
6 Esi
7 None
8 Вayo
9 Marie-Cha Kalisa
10 John Willia Johnson
11 Tony
12 Various
13 Amandina Lihamba Women Writing Africa: The Eastem Region
14 Nobantu Rasebotsa Nobody Ever Said AIDS: Poems and Stories from Southem Africa
15 Kevin
16 Werner
17 New
18 None
19 Gcina
20 Jacana
21 Sheila
22 ValZrie
23 Kenneth W.
24 Anthonia C.
25 Toyin
26 Monica
27 Linda
28 K.
29 Lorenz
30 Arja
31 Isabel
32 Valerie
33 Werner
34 Ron
Vera
Opening Spaces: An Anthology of Contemporary African Women's Writing
The Caine Prize for African Writing 2010: 11th Annual Collection
year
genre
H
publisher
1999 Anthologies
rating
price
Heinemann
2010 African Fiction
2 $14.52
New Intemationalist
2 $13.46
8 $18.95
2 $30.00
Carretta
Unchained Voices: An Anthology of Black Authors in the English-Speaking World
1983 Travel
Knopf Doubleday Publishing Group
University Press of Kentucky
Sutherland Women Writing Africa: West Africa and the Sahel
2003 History
2005 Literary Criticism
2009 Literary Collections
2006 Anthropology & Sociology
2009 Literary Criticism
2008 Literary Criticism
1991 Literary Criticism
10 Years of the Caine Prize for African Writing: Plus Coetzee
Ogunjimi Introduction to African Oral Literature and Perfomance
Feminist Press at CUNY
1 $29.95
6 $18.95
6 $23.95
9 $45.00
1 $24.95
9 $14.95
9 $12.71
9 $29.95
6 $22.13
2 $26.31
New Internationalist
Africa World Press
Violence in Francophone African and Caribbean Women's Literature
Oral Epics from Africa
African Fundamentalism: A Literary and Cultural Anthology of Garvey's Harlem F
Land Apart: A South African Reader
UNP Nebraska
Indiana University Press
Majority Press
Penguin Group (USA)
Martin
various
1987 African Literature
2007 Social Sciences
Feminist Press at CUNY
2010 Places
NB Publishers
Powell
Step into a World: A Global Anthology of the New Black Literature
An Anthology of Interracial Literature: Black-White Contacts in the Old World and
Internation: The Caine Prize 2009: The Caine Prize for African Writing 1Oth Annual Collection
2000 Peoples & Cultures
2004 Language Arts
2009 Short Story Anthologies
1999 Anthologies
2002 African Literature Anthologie: University Of KwaZulu-Natal Press
2006 Short Story Anthologies
Wiley John & Sons Inc.
New York University Press
Sollors
1 $32.23
6 $16.24
2 $7.55
New Internationalist
None
Traditions in World Literature: Literature of Africa
Glencoe/McGraw-Hill
Mhiophe Love Child
7 $8.97
3 $25.13
Media
Seventh Street Alchemy 2004: A Selection of Works from the Caine Prize for Afri
Jacana Media
Meintjes Women Writing Africa: The Southem Region: Volume 1
2002 Places
Feminist Press at CUNY
9 $1.99
[The Rowman & Littlefield Publishing Group Inc
8 $82.00
10 $116.43
Of Suffocated Hearts and Tortured Souls: Seeking Subjecthood through Madnes
Less Than One and Double: A Feminist Reading of African Women's Writing
The Rienner Anthology of African Literature
Oral and Written Expressions of African Cultures
Jambula Tree and other stories: The Caine Prize for African Writing 8th Annual C
Up the Down Escalator
Orlando
2002 Fiction & Prose
2001 Literary Criticism
2007 African Literature Anthologie: Lynne Rienner Publishers Inc.
2009 Anthropology & Sociology
2008 Short Story Anthologies
2010 Literary Collections
1995 Anthologies
Heinemann
8 $30.39
Carolina Academic Press
7 $26.88
Falola
3 $16.18
4 $10.95
4 $24.44
New Internationalist
Arac
NB Publishers
Rode
University of Natal Press
Boyds Mills Press
Limakatso Basali!: Stories by and about Women in Lesotho
10 $16.15
2000 Bible - Stories
How God Fix Jonah
8 $44.59
7 $33.63
10 $27.95
Graham
2005 African Literature Anthologies Jacana Media
2000 African Literature Anthologies Heinemann
Lexington Books
Salafranca Glass Jars among Trees
Running Towards Us: New Writing from South Africa
Of Suffocated Hearts And Tortured Souls
An Anthology of Interracial Literature: Black-White Contacts in the Old World and
Among the Blacks
The Daily Show with Jon Stewart Presents Farth (the Book): A Visitor's Guide to
Balseiro
2002 Social Sciences
2 $15.78
Key
New York University Press
2004 Literary Criticism
1988 African Literature Anthologie: Avenue B
2010 Humor
7 $14.00
2 $1.99
Sollors
Padgett
Grand Central Publishina
35 Hon
Stewart
Transcribed Image Text:Filter Select 1 first name last name title 2 Yvonne 3 None 4 Roger D. Abrahams African Folktales 5 Vincent 6 Esi 7 None 8 Вayo 9 Marie-Cha Kalisa 10 John Willia Johnson 11 Tony 12 Various 13 Amandina Lihamba Women Writing Africa: The Eastem Region 14 Nobantu Rasebotsa Nobody Ever Said AIDS: Poems and Stories from Southem Africa 15 Kevin 16 Werner 17 New 18 None 19 Gcina 20 Jacana 21 Sheila 22 ValZrie 23 Kenneth W. 24 Anthonia C. 25 Toyin 26 Monica 27 Linda 28 K. 29 Lorenz 30 Arja 31 Isabel 32 Valerie 33 Werner 34 Ron Vera Opening Spaces: An Anthology of Contemporary African Women's Writing The Caine Prize for African Writing 2010: 11th Annual Collection year genre H publisher 1999 Anthologies rating price Heinemann 2010 African Fiction 2 $14.52 New Intemationalist 2 $13.46 8 $18.95 2 $30.00 Carretta Unchained Voices: An Anthology of Black Authors in the English-Speaking World 1983 Travel Knopf Doubleday Publishing Group University Press of Kentucky Sutherland Women Writing Africa: West Africa and the Sahel 2003 History 2005 Literary Criticism 2009 Literary Collections 2006 Anthropology & Sociology 2009 Literary Criticism 2008 Literary Criticism 1991 Literary Criticism 10 Years of the Caine Prize for African Writing: Plus Coetzee Ogunjimi Introduction to African Oral Literature and Perfomance Feminist Press at CUNY 1 $29.95 6 $18.95 6 $23.95 9 $45.00 1 $24.95 9 $14.95 9 $12.71 9 $29.95 6 $22.13 2 $26.31 New Internationalist Africa World Press Violence in Francophone African and Caribbean Women's Literature Oral Epics from Africa African Fundamentalism: A Literary and Cultural Anthology of Garvey's Harlem F Land Apart: A South African Reader UNP Nebraska Indiana University Press Majority Press Penguin Group (USA) Martin various 1987 African Literature 2007 Social Sciences Feminist Press at CUNY 2010 Places NB Publishers Powell Step into a World: A Global Anthology of the New Black Literature An Anthology of Interracial Literature: Black-White Contacts in the Old World and Internation: The Caine Prize 2009: The Caine Prize for African Writing 1Oth Annual Collection 2000 Peoples & Cultures 2004 Language Arts 2009 Short Story Anthologies 1999 Anthologies 2002 African Literature Anthologie: University Of KwaZulu-Natal Press 2006 Short Story Anthologies Wiley John & Sons Inc. New York University Press Sollors 1 $32.23 6 $16.24 2 $7.55 New Internationalist None Traditions in World Literature: Literature of Africa Glencoe/McGraw-Hill Mhiophe Love Child 7 $8.97 3 $25.13 Media Seventh Street Alchemy 2004: A Selection of Works from the Caine Prize for Afri Jacana Media Meintjes Women Writing Africa: The Southem Region: Volume 1 2002 Places Feminist Press at CUNY 9 $1.99 [The Rowman & Littlefield Publishing Group Inc 8 $82.00 10 $116.43 Of Suffocated Hearts and Tortured Souls: Seeking Subjecthood through Madnes Less Than One and Double: A Feminist Reading of African Women's Writing The Rienner Anthology of African Literature Oral and Written Expressions of African Cultures Jambula Tree and other stories: The Caine Prize for African Writing 8th Annual C Up the Down Escalator Orlando 2002 Fiction & Prose 2001 Literary Criticism 2007 African Literature Anthologie: Lynne Rienner Publishers Inc. 2009 Anthropology & Sociology 2008 Short Story Anthologies 2010 Literary Collections 1995 Anthologies Heinemann 8 $30.39 Carolina Academic Press 7 $26.88 Falola 3 $16.18 4 $10.95 4 $24.44 New Internationalist Arac NB Publishers Rode University of Natal Press Boyds Mills Press Limakatso Basali!: Stories by and about Women in Lesotho 10 $16.15 2000 Bible - Stories How God Fix Jonah 8 $44.59 7 $33.63 10 $27.95 Graham 2005 African Literature Anthologies Jacana Media 2000 African Literature Anthologies Heinemann Lexington Books Salafranca Glass Jars among Trees Running Towards Us: New Writing from South Africa Of Suffocated Hearts And Tortured Souls An Anthology of Interracial Literature: Black-White Contacts in the Old World and Among the Blacks The Daily Show with Jon Stewart Presents Farth (the Book): A Visitor's Guide to Balseiro 2002 Social Sciences 2 $15.78 Key New York University Press 2004 Literary Criticism 1988 African Literature Anthologie: Avenue B 2010 Humor 7 $14.00 2 $1.99 Sollors Padgett Grand Central Publishina 35 Hon Stewart
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Files and Directory
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education