Design a program in Java that implements the classic game Battleship.

Responsive Centered Red Button

Need Help with this Question or something similar to this? We got you! Just fill out the order form (follow the link below), and your paper will be assigned to an expert to help you ASAP.

The program must not open any windows and must only be run within an IDE console.
Battleship
Task
Design a program in Java that implements the classic game Battleship.
Specifications:
A two player game
Each player receives a game board (size: 10×10) and five ships of varying lengths.
The five ships are:
Carrier – length 5
Battleship – length 4
Cruiser – length 3
Submarine – length 3
Destroyer – length 2
Neither player should be able to see their opponent’s grid and ship locations.
Before the game starts, each opponent secretly places their five ships on the grid.
Each ship must be placed horizontally or vertically across grid spaces.
Ships can touch each other, but they can’t occupy the same grid space.
You cannot change the position of the ships after the game begins.
Players take turns firing shots by specifying a grid coordinate in an attempt to hit the enemy ships.
This should be a letter and a number that identifies a row and column on your target grid.
The coordinate is validated and the program should determine if it’s a ‘miss” or “hit”.
Every shot, hit or miss, should be logged and displayed on the player’s board.
As the game progresses, misses will gradually identify the size and location of the enemy’s ships.
When a player’s ship has been sunk, the phrase “You sunk my [type of ship]!” should be displayed.
The first player to sink all five of their opponent’s ships wins the game.
The program should allow the players to restart the game.
The program should keep track of wins and losses.
Your program should include the classes listed below:
Ship Class
Fields:
shipType: String
shipLocations: String[]
shipSunk: boolean
Methods:
setLocations()
isHit()
isSunk()
GameBoard Class
Fields:
gameBoard: char[][]
Methods:
getGameBoard()
setGameBoard()
Player Class
Fields:
name: String
gameBoard: GameBoard
wins: int
losses: int
Methods:
getName()
setName()
getWins()
setWins()
getLosses()
setLosses()
Game Class
Fields:
inPlay: Boolean
playerOne: Player
playerTwo: Player
playerOneShips: Ship[]
playerTwoShips: Ship[]
Methods:
placeShips()
attack()
gameOver()
Main Class
Methods:
Main()
Class includes all necessary properties and methods, including constructors.
Program logic is sound and efficient.
All necessary validation is present..
No syntax and/or runtime errors.
User prompts are clear and intuitive.
Code is appropriately commented.

How to create Testimonial Carousel using Bootstrap5

Clients' Reviews about Our Services