Question: Battleship Java program using GUI by implementing java swing. The game will be implemented using Graphical User Interface (GUI). The following rules for the games

Battleship Java program using GUI by implementing java swing.

The game will be implemented using Graphical User Interface (GUI). The following

The game will be implemented using Graphical User Interface (GUI). The following rules for the games have to be included in the program: 1. Choose the grid size from either a 10x10, 12x12 or 15x15. The user should be able to make this selection. 2. The number of ships for each type could be either chosen at random or taken as user input, provided that the number of boxes in the grid occupied is not more than 50%. So, on a typical 12x12 grid, the number of boxes occupied by the ships should be no more than 72. In case of user input, if the user cannot provide acceptable number of ships in 2 attempts, randomly generate the number of ships for them. 3. You need to create a class for the board. 4. You need to create an abstract class for Ship; Ship must be extended to create separate classes for each of the specific types of ships i.e., Carrier, Battleship, Destroyer, Submarine and Patrol Boat. 5. The game is to be played by a player against the computer. You will have to program the logic of the game for the computer. Basic logic should include not choosing boxes outside bounds, not choosing same box twice etc. The level of computer play can be basic or advanced; in case of advanced level the computer will have a strategy similar to one you will use to play the game against an opponent. You need to clearly document this strategy in your program by writing it out as a block comment. 6. For each box chosen by opponent, declare a "miss", "hit" or "sink" as appropriate. 7. Each of the 4 boards must be shown after each round. This is not typical for the game, but required for the project to ensure the correctness of implementation.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!