import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.PrintStream; public class TowersOfHanoiExecute { public static void main(String[] args) {// TODO Auto-generated method stub int startPeg = 1; //Value 1 is used to indicate startPeg in output int endPeg = 3; //Value 3 is used to indicate endPeg in output int tempPeg = 2; //Value 2 is used to indicate tempPeg in output int totalDisks = 3; //number of disks System.out.println("TowerOfHanoi text file has been created"); TowersOfHanoi towersOfHanoi = new TowersOfHanoi( totalDisks ); //read into applet readFileApplet myreadFileApplet = new readFileApplet(); myreadFileApplet.readFile(); PrintStream stdOut=null; try { stdOut = new PrintStream(new FileOutputStream ("TowerOfHanoi.txt")); } catch (FileNotFoundException e) { e.printStackTrace(); } System.setOut(stdOut); //initial nonrecursive call: move all disks. towersOfHanoi.solveTowers( totalDisks, startPeg, endPeg, tempPeg ); }//end main }//end class TowersofHanoiExecute