Question: a. We have not shown the code for the method moveDisk. It could either just print out a message (using System.out.println) describing which disk is
a. We have not shown the code for the method moveDisk. It could either just print out a message (using System.out.println) describing which disk is moved from where to where, or it could result in altering a picture of needles and disks. Write out the code for the text-only version of moveDisk.
b. (The following program requires arrays, covered in Chapter 14) Write the code for an animated graphic version of Towers of Hanoi where there is a delay between each move of a disk. That is, let an ActiveObject control the animation of the algorithm. Interestingly, the code for the graphics is several times as long as the actual code for determining which disk should be moved next.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
