Starting from:
$30

$24

Lab #4 Solution

Towers Of Hanoi




For this lab, you will de ne some methods of the class TowersOfHanoi. It has only one eld which is a Tower array of three elements. Make sure to study the header le \Archive.h" before proceeding.




Your group will have to rewrite the given method so that they perform their descriptions correctly.




The header le \Copy.h" contains the class TowersOfHanoi methods



Public copy constructor that performs a shallow copy.




Public overloaded assignment operator that performs a shallow copy.




The header le \Move.h" contains the class TowersOfHanoi method



Public bool method named Move() that takes two int parameters named from and to respectively. It returns true if from and to are both between 0 and 2 inclusively, towers whose index is from is not empty, and the top of towers whose index is from can be added to towers whose index is to; otherwise, it return false. If it returns true, the actual move must occur.




The header le \Reset.h" contains the class TowersOfHanoi method



Public void method named Reset() that takes no parameters. It resets towers to their original con guration.




IV. The header le \Success.h" contains the class TowersOfHanoi method




Public bool constant method named Success() that takes no parameters. It retruns true if towers whose index is 2 is the only none empty tower.

More products