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

Classes The code within the links need to be implemented!! Study Call Hierarchy

ID: 3685268 • Letter: C

Question

Classes

The code within the links need to be implemented!!

Study Call Hierarchy feature of MSVS described here. As you work on the below project, demonstrate viewing code hierarchy to the lab instructor.

In this project, you are to re-code the battleship game using classes. The data code and data is declared this header file(http://vega.cs.kent.edu/~mikhail/classes/csi/Labs/Lab9/battleship.h) . The information about locations, ship and entire fleet is encapsulated in classes.

Assignments

Test. Create a project titled Lab9_Test. Add header file battleship.h. (http://vega.cs.kent.edu/~mikhail/classes/csi/Labs/Lab9/battleship.h) to the project. Add test source file testShips.cpp (http://vega.cs.kent.edu/~mikhail/classes/csi/Labs/Lab9/testShips.cpp) to the project. Define member functions for the classes of battleship.h and place the defined member functions in battleship.cpp.

You should implement the member functions for classes incrementally. Start with implementing member functions for class location, then proceed to ship and then to fleet. Uncomment the portions of testShips.cpp as you work on a particular class. Once your project works correctly with all code of testShips.cpp uncommented, submit your project.

Game. Create a project titled Lab9_Game. Use battleship.h, battleship.cpp from the test assignment above; add game.cpp that contains main() , invokes the game functions declared in battleship.h and implements the Battleship game

Hint: the pseudocode for your main() should be as follows:

Explanation / Answer

game.cpp

battleship.cpp

sample output:

Would You like to know the possitions of the ships? y/n                                                                                                       
y                                                                                                                                                             
5c Not Sunk                                                                                                                                                   
5b Not Sunk                                                                                                                                                   
1e Not Sunk                                                                                                                                                   
1a Not Sunk                                                                                                                                                   
3c Not Sunk                                                                                                                                                   
  Where would you like to fire (Ex:'c 4')   

3 c                                                                                                                                                           
You hit one!                                                                                                                                                  
5c Not Sunk                                                                                                                                                   
5b Not Sunk                                                                                                                                                   
1e Not Sunk                                                                                                                                                   
1a Not Sunk                                                                                                                                                   
3c Sunk                                                                                                                                                       


Where would you like to fire? (Ex: 'c 4')   

6 d                                                                                                                                                           
You missed!                                                                                                                                                   
5c Sunk                                                                                                                                                       
5b Not Sunk                                                                                                                                                   
1e Sunk                                                                                                                                                       
1a Sunk                                                                                                                                                       
3c Sunk