Being able to read in a text file into an array of objects using the Scanner class is mission-critical in the final grade 12 practical exam paper. Here are some examples for you to practice with. 

1) This text file has 5 fields ie Order, Restaurant, Description, Quantity and priceEach. Note one order can be made up of a single item or a number of items.

Create a three-class program with a UI class, a manager class and an order class. Using the constructor method the manager class must read in the food order text file and create an array of food orders. The manager class must also have a printAll method that prints out all the elements in the order array.

Click here for foodorders.txt

2A) Array of districts. You have been given a text file named “Records.txt”. This file contains data about the circuits, the district the circuit belongs to and the schools that have recorded infections for a certain date.

Please note that every 2 lines in the text file has the following information:
Circuit Name;District Name;Fee Paying District;District Rank;Record Date
School IDs separated by #

Create a three-class program with a UI class, a manager class and a district class. Using the constructor method the manager class must read in the recrords text file and create an array of districts. The manager class must also have a printAll method that prints out all the elements in the district array.

The district class will only have three fields – districtName (String), feePaying (boolean) and rank (integer)

Click here for records.txt