import java.io.*; import java.util.Scanner; /** Checkbook main program * * @author Duncan Buell * * written: 14 October 2007 */ public class Main extends Object { public static void main(String[] args) { // CheckBook theCheckBook = new CheckBook(); CheckBook2 theCheckBook = new CheckBook2(); Scanner dataFile = null; /********************************************************************* * open a file as a Scanner. * * The main purpose of this complicated stuff is to do error checking * so as to check that the file is in fact open as needed. * */ try { dataFile = new Scanner(new File("theDataFile.dat")); } catch (FileNotFoundException ex) { System.out.println("ERROR opening inFile " + "theDataFile.dat"); System.out.println(ex.getMessage()); System.out.println("in" + System.getProperty("user.dir")); System.exit(1); } System.out.println("File opened, continue"); theCheckBook.doCheckBook(dataFile); System.out.println("File processed, terminate"); } }