Question: Objective: Write a java program that reads in a text file containing the coordinates of two battleships. Implement three different strategies(using the strategy design pattern)
Detailed Description Create a data structure that represents a 25X25 grid. You will use this grid to place the two battleships and to track the progress of your search for the battleships 1. Read in Coordinates Coordinates are stored in a file named "input.txt". Each line represents ONE game- so the following sample represents three different runs of the game. For each game there is one carrier and one submarine. The carrier occupies 5 cells-represented by the first five coordinates in the line (below), and the submarine represents the remaining three coordinates. See example below (0,0 0,1)0,20,3)0,4)4,15)(4,16) 4,17) (5,9)15,1015,11)5,12)(5,13)120,5)(20,6)(20,7) (15,3)(16,3117,3)18,3)19,3124,6124,7)124,8) Create a 25X25 grid and place the carrier and submarine onto the grid. (Note: This is a non-GUl assignment- although you can create a GUI if you want to). We will start using a GUI in assignment #2. 2. 3. Create a BattleshipSearch class This class is responsible for searching the grid for both the carrier and the submarine. (Note: Just reading the results from the input file and omitting the search step will SIGNIFICANTLY REDUCE your grade). You need to read in the coordinates, place the ships, and then independently search for them! You must use a search strategy and will output the text shown at the bottom of the page to the console for each game (with example coordinates from first row of text file). For each game you will systematically use each of the following three search strategies
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
