Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In java, please! I'm having trouble with this. How would you pass a file into different methods using scanner? Class Library{ private String name;//name of

In java, please! I'm having trouble with this. How would you pass a file into different methods using scanner? Class Library{ private String name;//name of library public Library(String name){ this.name = name; } //Methods: public void getName(String filename) //TODO: This method takes in the text file and is responsible for parsing the file into a collection of objects. This method will call the storeBooks(), storeShelf(), and storePerson(), in processing the text file. public void storeBooks(int count, Scanner sc) //TODO: This takes in an integer, the numbers of books to parse, and a scanner that represents the current position of the text file. public void storeShelf(int count, Scanner sc) //TODO: This takes in an integer, the number of shelves to parse, and a scanner that represents the current positions of the text file. public void storePerson(int count, Scanner sc) TODO : this also works the same as the storeBook and storePerson method public static void main(String[] args){ Library temp = new Library("Temporary); Temp.getName(library.txt); } } The text file will contain a list of comma-separated values that represent the books, shelf, and person. The numbers 4,3,4, correspond to the number of records to follow and each of them will be parsed to their methods. The text file: 4 // number of books: Harry Potter Percy Jackson Smile Intro to Java 3 //number of shelves Fiction Non-fiction Novel 4 // number of people James Rush, 123-456-7890 Luna Rush, 456-908-7689 Tina Rush, 678-895-4567 Guy Rush, 456-456-8934

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions