import java.io.*; public class Scan1 { static BufferedReader keyboard = new BufferedReader (new InputStreamReader (System.in)); final static String SENTINEL = "999"; public static void main (String[] args) throws IOException { String file = "invoice1.dat"; PrintWriter outFile = new PrintWriter (new FileWriter (file)); String item, price; // output directions System.out.println ("This order-processing program simulates " + "using a"); System.out.println ("code reader to scan an item and create " + "an invoice\n"); // ask the user for name of the first item System.out.print ("Please scan the name of the first item: "); item = keyboard.readLine(); while (!item.equals(SENTINEL)) { // ask the user for the price // output item and price to the data file // ask the user for another item } System.out.println ("All items scanned."); outFile.close(); } // end of main method } // end of class Scan1