/* Display1.java CIS 111 10/31/07 David Klick This program displays the text file generated by Create1.java */ public class Display1 extends CIS111App { public static void main(String[] args) { int year, month, day; double amt; String filename = "sales.txt"; int recs = 0; double gtot = 0.0; SequentialFile filein; clearConsole(); filein = new SequentialFile(filename, FileMode.INPUT); println("Date Amount"); println("---------- ----------"); while (!filein.eof()) { year = filein.readInt(); month = filein.readInt(); day = filein.readInt(); amt = filein.readDouble(); recs = recs + 1; printf("%02d/%02d/%04d %10.2f\n", month, day, year, amt); gtot = gtot + amt; } printf("\nTotal: %10.2f (%d records)\n", gtot, recs); filein.close(); } }