Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!