Classes

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

Battleship with Classes. Create a project titled Lab9_BattleshipClasses. Restructure your project from the previous lab assignment such that the information about battleships and shots is located in classes. If you have not done the battleship assignment of the previous lab, contact the lab instructor. He will supply you with working code for it. Note that in this case you will get no credit for the previous lab.

You should use this header file.

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. You should use this code to test your code. Uncomment the portions of the file as you work on particular class.

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

   declare an object of class fleet
   call deployFleet() method on it
   prompt the user if ships' positions and status need to be printed
   loop while method operational() returns true - i.e. at least one ship is not sunk.
       Inside the loop,
       declare an object of class location, 
       invoke fire() on it to get the location of the user's shot,
       pass this object to isHitNSink() method of
	   your fleet object
       analyze the return value of this method and report a hit or a miss
       if requested printing ships' status 
           invoke printFleet()
  

Make sure your programs adhere to proper programming style. Submit your projects to the subversion repository. Do not forget to verify your submission on the web.