Create a recursive function called moveDisks that takes 4 parameters:
The function should do the following:
The message printed out in the moveDisks should be formatted as such:
1 --> 3 (This means move one disk from peg 1 to peg 3)
In your main method, explain to the user that the program will solve the Towers of Hanoi problem, ask the user for the number of disks, then call moveDisks to show how the specified number of disks would be moved from peg 1 to peg 3. The number of disks must be from 1 to 12. If the user enters a number outside this range, ask the user for the number of disks again. Keep asking the user until a value from 1 to 12 is entered.
Following is a sample run of the program:
This program will show you how to solve the Towers of Hanoi problem for a number any number of rings from 1 to 12. Please enter the number of rings: 0 That number is invalid. Please enter the number of rings: 45 That number is invalid. Please enter the number of rings: 3 1 --> 3 1 --> 2 3 --> 2 1 --> 3 2 --> 1 2 --> 3 1 --> 3