import java.util.Scanner; import java.io.PrintWriter; import java.io.File; public class Prog3b { public static void main(String[] args) { System.out.println("Program 3, Dennis Thompson, masc001"); if(args.length != 2) { System.err.println("Usage: java Prog3b infileName outfileName"); System.exit(1); } Scanner handle = null; PrintWriter out = null; try { handle = new Scanner(new File(args[0])); } catch(java.io.FileNotFoundException e) { System.err.println(e.getMessage()); System.exit(1); } try { out = new PrintWriter(System.getProperty("user.dir") + "/" + args[1], "UTF-8"); while(handle != null && handle.hasNextLine()) { out.println(handle.nextLine().replace(' ', ',')); } out.close(); } catch(java.io.IOException e) { System.err.println(e.getMessage()); System.exit(1); } finally { out.close(); handle.close(); } } }