Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ help please show program working and each file with a label please. The file

ID: 3716111 • Letter: C

Question

C++ help please show program working and each file with a label please. The files should be labeled as:

prog8disk.h, prog8tower.h, prog8tower.cpp, prog8client.cpp

Thank you!

Mandatory Instructions Develop a C?object oriented solution to the Towers of Hanoi puzzle. Your solution will involve designing two classes one to represent individual Disk and another to represent the TowersOfHanoi game. TowersOfHanoi class will implement the game with three linked lists representing disks on each of the tower's pegs... Nodes of the linked lists will be dynamically instantiated objects of the Disk class. There is NO inheritance relationship between these two classes. Disk Class Place the class definition in prog8disk h Implement all of this class' functions as Include only the necessary e files in the pro file. This class will define a single disk that is used in the puzzle. The disk will have a certain weight Qarger disks will have larger weight, smaller disks will have smaller weight). If the puzzle has 4 disks, we will assign largest disk weight 4, then next largest 3, etc. down to the smallest disk which will have weight 1. Use an appropriate private data member to represent this disk weight. Also provide an accessor function to return the disk weight. Since objects of this class will be nodes in a linked list, add another private data member that will be able to "point to the next Disk node. Provide mutator and accessor functions to get/set this pointer data member. Provide a default constructor that will set all data members to values that make sense such as 0 and nullptr Provide an overloaded constructor that will accept ONLY the weight as a parameter setting data member to the given weight and pointer to nullptr Provide a destructor for the class. It will be empty

Explanation / Answer

#include #include #include "Location.h" using namespace std; //Class for the tower class Tower { private: Location _location; public: //Constructor to build object Tower(Location location); //set get functions to set and get values. void setLocation (Location newLocation); Location getLocation()const; }; enum Location { start, middle, last }; using namespace std; class Disk { private: int _diskLocation; int _diskSize; public: Disk(Tower tow1, int sizeOfDisk); void setdiskSize(int); int getdiskSize()const; void setdiskLocation(Tower newTower); Tower getdiskLocation()const; }; using namespace std; Tower::Tower(Location location) { setLocation(location); } Disk::Disk(Tower tow1, int sizeOfDisk) { setdiskSize(sizeOfDisk); setdiskLocation(tow1); } int main(int argc, const char * argv[]) { Tower tower1(start); Tower tower2(middle); Tower tower3(last); int numberOfDisks =0; cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote