Inside your lab11 directory, create a file named Lab11d.java. Inside Lab11d.java write a program that behaves as follows.
-
- Create an instance of the Scanner class that can read from students.txt.
- Change the delimiters of the Scanner so that it returns tokens that are separated by commas and newline characters.
- Read the first integer in the students.txt and store the integer in memory.
- Create an array of Student elements named arr whose length is equal to the integer previously read from student.txt.
- While there is data to be read from the file
- Read in a student’s ID, last name, and first name and store them in local variables.
- Create an instance of the Student class using the data read from the file.
- Add the newly created instance to arr.
- Use a for-loop to iterate over the instances of the Student class that are in arr.
- For each instance, print to the screen the String that is returned by the instance’s toString method.
Compile, debug, test, and push.