Question: I need help with completing this program which is to reads data from a file and stores it in a two-dimensional array and then uses

I need help with completing this program which is to reads data from a file and stores it in a two-dimensional array and then uses nested for-loop to print the values in a table format. I was trying to use this text file below:

The following retailers below made Glassdoor's 100 Best Places to Work - U.S. list.

1. (Rank: 9) lululemon

Company Rating: 4.5

2. (Rank: 32) Trader Joe's

Company Rating: 4.4

3. (Rank: 33) H E B

Company Rating: 4.4

4. (Rank: 55) eBay

Company Rating: 4.3

5. (Rank: 56) Apple

Company Rating: 4.3

6. (Rank: 78) Este Lauder Companies

Company Rating: 4.2

7. (Rank: 80) Wegmans Food Markets

Company Rating: 4.2

8. (Rank: 84) Vans

Company Rating: 4.2

9. (Rank: 88) Madewell

Company Rating: 4.2

10. (Rank: 90) Scheels

Company Rating: 4.2

11. (Rank: 93) Costco Wholesale

Company Rating: 4.2

12. (Rank: 95)REI

Company Rating: 4.2

13. (Rank: 98) Malouf Companies

Company Rating: 4.2

This how far I got: Please assist with the correct java code for program.

import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException;

/** * */

/** * @author * */ public class FileIO {

public static void main(String[] args) {

String[] companies = {"lululemon", "Trader Joe's", "H E B", "eBay", "Apple"}; try { BufferedWriter writer = new BufferedWriter(new FileWriter("output.txt")); writer.write("The following retailers below made Glassdoor's 100 Best Places to Work - U.S. list."); for (int i = 0; i < companies.length; i++) { writer.write(" \"lululemon\", \"Trader Joe's\", \"H E B\", \"eBay\", \"Apple\""); } writer.close(); } catch (IOException e) { e.printStackTrace(); }

}

}

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 Programming Questions!