import java.util.*; import java.io.*; public class Prog7 { public static void main(String[] args) { String warehouseID = null; String city = null; String state = null; final int MAX_WAREHOUSE = 20; final int MAX_PARTS = 30; int numOfWarehouses = 0; int counter = 0; Scanner inFile = null; Warehouse warehouse [] = new Warehouse [MAX_WAREHOUSE]; try { inFile = new Scanner( new File ( "warehouse.txt" ) ); } catch( FileNotFoundException e) { System.err.println( " Error: File warehouse.txt not found"); } while ( inFile.hasNext() ) { warehouseID = inFile.next(); city = inFile.next(); state = inFile.next(); warehouse[numOfWarehouses] = new Warehouse(warehouseID, city, state); numOfWarehouses++; } String partNumber = null; String description = null; double price = 0.0; String warehouseID2 = null; int quantity = 0; Part parts[] = new Part [MAX_PARTS]; try { inFile = new Scanner ( new File ( "parts.txt" ) ); } catch( FileNotFoundException e) { System.err.println(" Error: File parts.txt not found"); } while( inFile.hasNext() ) { String str = inFile.nextLine(); String [] tokens = str.split(",[ ]*"); partNumber = tokens[0]; description = tokens[1]; price = Double.parseDouble( tokens[2] ); warehouseID2 = tokens[3]; quantity = Integer.parseInt( tokens[4] ); parts[counter] = new Part(partNumber, description, price, warehouseID2, quantity); counter++; } Arrays.sort( parts ); for( int i = 0; i < parts.length; i++) { System.out.println( parts[i] ); } } }