Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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)

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) for locating the battleships.
1. Create a UML class diagram of your soultion.
2. Explain your design decisions.
image text in transcribed
image text in transcribed
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

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

Visual Basic Net Database Programming

Authors: Rod Stephens

1st Edition

0789726815, 978-0789726810

More Books

Students also viewed these Databases questions

Question

Differentiate tan(7x+9x-2.5)

Answered: 1 week ago

Question

Explain the sources of recruitment.

Answered: 1 week ago

Question

Differentiate sin(5x+2)

Answered: 1 week ago

Question

Compute the derivative f(x)=1/ax+bx

Answered: 1 week ago