Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

It's the end of the semester and I have a big project to do. It's a multi-class Battleship game. However, I seem to be having

It's the end of the semester and I have a big project to do. It's a multi-class Battleship game. However, I seem to be having problems with the BattleBoard.java class, more specifically the public boolean isShipSunk(int shipIndex), the public ArrayList getAllSunkenShips(), and the public HitStatus getHitStatus(int row, int col) methods. I simply have no idea what they need to look like. Here are the instructions

public boolean isShipSunk(int shipIndex): returns true if the ship at the specified index in the array has been sunk by enemy fire.

public ArrayList getAllSunkenShips(): returns an ArrayList of Ships that have been sunk by enemy fire.

public HitStatus getHitStatus(int row, int col): returns the HitStatus of the Square located at the specified row and column. Throw an IllegalArgumentException if row < 0, col < 0, row >= number of rows, or col >= number of columns.

For reference, this is the HitStatus enum from my Square class

public enum HitStatus {

HIT, //hit and occupied

MISSED, //hit and unoccupied

NOT_YET_HIT// not yet hit

}

I need to know exactly what these methods are supposed to look like

Here is a link to my code if you need to see it

https://drive.google.com/file/d/0B1nKgE0afMEmMGxuNmlUdE04WHM/view?usp=sharing

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft SQL Server 2012 Unleashed

Authors: Ray Rankins, Paul Bertucci

1st Edition

0133408507, 9780133408508

More Books

Students also viewed these Databases questions