Question: /* CSE 271 Lab-01 FileIO-Arrays Name: */ public class Tester { // arrays to store your data //id fName lName address city state zip shirtSize

/* CSE 271 Lab-01 FileIO-Arrays Name: */ public class Tester { // arrays to store your data //id fName lName address city state zip shirtSize gender public static int[] id; public static String[] fName, lName, address, city, state, zip, shirtSize, gender; // static variable to keep the number of records in the file public static int records = 0; public static void main(String[] args) { // We know we have NO MORE than 1000 records so // set all the arrays to a size of 1000 setArrays(1000); // Load the file into arrays loadFile("Lab-01_DataFile.txt"); // Print the report printReport("OH"); System.out.println(); // a separator blank line between the prints // Print all names for people living in a given state printAllNamesFrom("NJ"); System.out.println(); // a separator blank line between the prints // Print the number of records read in from the file System.out.println("Total Records Read: "); } // Fully loads the "fileName" file // Each column is separated by a single tab. public static void loadFile(String fileName) { // Read in the file and populate the arrays. // Consider writing a helper method so code // in this method is short and clean } // Prints the following report ==================== // // Data from OH // ============ // Total males : 465 // Total females : 529 // Total OH males : 17

// Total OH females : 16 // Total OH XS shirt size : 6 // //================================================= public static void printReport(String st) { // Code the report here by evaluating the arrays. // Output should match the above format and values. } // Prints all user names from a given state ==================== // // People living in NJ // =================== // O'Dempsey, Imojean // Piburn, Ashlie // Nicol, Eric // Quarrington, Bernelle // Lief, Constancy // Petcher, Bertha // Veel, Jaymee // Rising, Othelia // Suckling, Hatty // Crosland, Dani // //=========================================================== public static void printAllNamesFrom(String st) { // Print all people from a given state. // Output should be in the format: lastName, firstName } //=========================================================== HELPER METHOD // A helper method that sets the size of each array to the // proper length needed to store data. private static void setArrays(int records) { id = new int[records]; fName = new String[records]; lName = new String[records]; address = new String[records]; city = new String[records]; state = new String[records]; zip = new String[records]; shirtSize = new String[records]; gender = new String[records]; } }

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!