import java.util.*; import java.io.*; import java.text.DecimalFormat; public class Inventory { public static void main( String[] args ) { final int MAX = 100; InvItem[] items = new InvItem[MAX]; StringTokenizer tokenizer; String line, name, filename="items.dat"; int units, count=0; float price; // read data from file into program variables try { FileReader fr = new FileReader( filename ); BufferedReader infile = new BufferedReader( fr ); line = infile.readLine(); while( line != null ) { tokenizer = new StringTokenizer( line ); name = tokenizer.nextToken(); try { units = Integer.parseInt( tokenizer.nextToken() ); price = Float.parseFloat( tokenizer.nextToken() ); items[count++] = new InvItem( name,units,price ); } catch( NumberFormatException nfx ) { System.out.println( "error in input; line ignored: " + line ); } line = infile.readLine(); } // end of while infile.close(); } catch( FileNotFoundException fnfx ) { System.out.println( "file not found: " + filename ); } catch( IOException iox ) { System.out.println( iox ); } // manipulate the values of the program variables: // increase the prices by 10% for ( int i=0; i