Question: Problem Description ASU Home My ASU College In this lab you will read in String data from a file and store them in an array.

 Problem Description ASU Home My ASU College In this lab youwill read in String data from a file and store them inan array. Step 1: Getting Started Create a new .java file namedLab12.java. At the beginning of this file, include your assignment documentation code

Problem Description ASU Home My ASU College In this lab you will read in String data from a file and store them in an array. Step 1: Getting Started Create a new .java file named Lab12.java. At the beginning of this file, include your assignment documentation code block. After the documentation block, you will need several import statements. import java.util.Scanner; import java.io. BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; Next, declare the Lab12 class and define the main function. public class Lab12 { public static void main (String [] args) { Step 2: Declaring Variables For this section of the lab, you will need to declare 1 local variable: a String that we will use to store the data read from a file. Declare this variable inside of the main function. 11 A String for the strings that we will read from file. // --> Step 3: Declare the Array ASU Home My ASU College Make an 2D array with 12 elements (4 rows and 3 columns) This declaration is very similar to the way we have declared Scanner, Person, Student, and Employee objects in the past. Make sure to declare a String array. // For reference, the following is an EXAMPLE declaration of an // String [] [] Array1 = new String [4][3]; // --> Step 4: Create a text file Make a text file and write 12 strings in it, one string on each line, and then save it in the folder that you want to save your program in it. The text file and your java program must be in the same folder. Step 5: read from the file ASU Home My ASU College: In this step you must open the file that you made in the step 4 and read the file. // put all the commands of this step in a try block try { // Make a fileReader object to open the file that you want // You the name of the file that you made in step 6 FileReader fr = new FileReader name of the file); // define a BufferedReader named inFile to read from the file // --> // use a nested for loop structure to read all lines of file for (int row = 0; row

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!