Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA Data Structures class please see below thank you! _________________________________________________________________ 1) You are given a file whose first few lines look like this Madagascar 226658.3

JAVA Data Structures class please see below thank you!

_________________________________________________________________

1) You are given a file whose first few lines look like this Madagascar 226658.3 Cyprus 3572.5 Sri Lanka 25330.1

Every island is represented by 2 lines. the first is the name and the second is the area. Write a java class called IslandReader with the following features: -Instance variable BufferedReader br -A constructor Island(BufferedReader br) that stores its arg in the br instance variable. Assume that whenever this constructor is called, br is connected to a correctly structured island file like the one above with of unknown length -A method public Island readIsland() throws IOException which reads 2 lines from the buffered reader and returns the instance of Island. The method should return null when it reaches the end of file.

2) Write the following method for the Island class: ArrayList getIslands(File islandsFile) throws IOException.The method should return a list of islands in order of appearance in the file.

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

Step: 3

blur-text-image

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

Joe Celkos Data And Databases Concepts In Practice

Authors: Joe Celko

1st Edition

1558604324, 978-1558604322

More Books

Students also viewed these Databases questions

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago