Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please make use of classes in c++ and don't ost the answer from the other similar question posted. Also, there needs to be a constructor
Please make use of classes in c++ and don't ost the answer from the other similar question posted. Also, there needs to be a constructor Battleship A. Thanks!
Finally, fill in the code for a play function that uses the battleShip class and runs a game of Battleship. Keep hitting all three ships until all three have been sunk, and always hit them in the order Destroyer, Carrier,then Cruiser void play) Cruiser //TODO: Declare 3 instances/objects of the battleship class: Destroyer Carrier /TODe: Give the ships a size: Destroyer-3 Carrier-5 Cruiser-2 // you will need to call the appropriate methods // Once you have this running for one, expand this while loop to include the // other two instances. Have the while loop end when all three ships have been // sunk. Make your while condition while ship one is sunk OR ship two is sunk OR ship three is sunk while(ship-one.isSunk() == false){ ship_one.recordHit); Finally, fill in the code for a play function that uses the battleShip class and runs a game of Battleship. Keep hitting all three ships until all three have been sunk, and always hit them in the order Destroyer, Carrier,then Cruiser void play) Cruiser //TODO: Declare 3 instances/objects of the battleship class: Destroyer Carrier /TODe: Give the ships a size: Destroyer-3 Carrier-5 Cruiser-2 // you will need to call the appropriate methods // Once you have this running for one, expand this while loop to include the // other two instances. Have the while loop end when all three ships have been // sunk. Make your while condition while ship one is sunk OR ship two is sunk OR ship three is sunk while(ship-one.isSunk() == false){ ship_one.recordHit)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started