Marine Questions 1-8 1. The use of the RandGen object is encapsulated within the AquaFish class, and this is included with the main program. 2. They are all individually compiled and the linker links all of them together. 3. AquaFish::AquaFish(int tankSize, int initPosition) : myPosition(initPosition),myTankSize(tankSize),myBumpCount(0),myDebugging(true) 4. AquaFish::AquaFish(int tankSize, int initPosition, bool debug) : myPosition(tankSize/2),myTankSize(tankSize),myBumpCount(0),myDebugging(debug) 5. Although allowing the user to stop the program from printing out position every time may lead to some confusion or error, giving the user a choice in the matter makes the program more user friendly in general. If a lot of fish are in the tank and making many moves, the user does not always have interest in the position of every fish after every move. 6. AquaFish::AquaFish(int tankSize) : myPosition(tankSize/2),myTankSize(tankSize),myBumpCount(0),myDebugging(true),minPos(myPosition),maxPos(myPosition) { } void AquaFish::Swim() { RandGen randomVals; int flip; if (myPosition == myTankSize - 1) { myPosition--; if (myPosition < minPos) minPos = myPosition; } else if (myPosition == 0) { myPosition++; if (myPosition > maxPos) maxPos = myPosition; } } . . . void AquaFish::MinPos() { cout << "the minimum position is - " << minPos << endl; } void AquaFish::MaxPos() { cout << the maximum position is - " << maxPos << endl; } 7. Without debugging enabled, the only time the aquafish program displays any output is at the end, so if there was a small runtime error in the code that the compiler was unable to catch, it would be difficult to find where in the code it was occuring. 8. AquaFish::AquaFish(int tankSize) : myPosition(tankSize/2),myTankSize(tankSize),myBumpCount(0),myDebugging(true),visits[tankSize](0) { } void AquaFish::Swim() { RandGen randomVals; int flip; if (myPosition == myTankSize - 1) { myPosition--; visits[myPostion]++; } else if (myPosition == 0) { myPosition++; visits[myPostion]++; } . . . int AquaFish::visits (int index) { return visits[index]; }