Question: rite a Java program which will accept an input file as a command line argument. This text file contains the following information for a battleship

 rite a Java program which will accept an input file asa command line argument. This text file contains the following information fora battleship configuration: * Size of the square grid as an intNumber of battleships and sizes in grids (Battleships can have a size

rite a Java program which will accept an input file as a command line argument. This text file contains the following information for a battleship configuration: * Size of the square grid as an int Number of battleships and sizes in grids (Battleships can have a size from 2 to 6.) Battleship grid where 0's are blank spaces and 1's are battleships (The battleships can only go up and down or side to side, not diagonal. The battleships will also not touch or overlap) A sample input file would contain look like this: It is an 8 x 8 grid There are 4 battleships of sizes 2, 3, 4, and 5. Y ou can the grid. 4 2 3 4 5 1 11 1 0 0 0 1 00 0 0 1 0 0 1 0 0 0 0 1 0 0 1 see the ships in 0 0 0 0 1 0 0 0 rite a Java program which will accept an input file as a command line argument. This text file contains the following information for a battleship configuration: * Size of the square grid as an int Number of battleships and sizes in grids (Battleships can have a size from 2 to 6.) Battleship grid where 0's are blank spaces and 1's are battleships (The battleships can only go up and down or side to side, not diagonal. The battleships will also not touch or overlap) A sample input file would contain look like this: It is an 8 x 8 grid There are 4 battleships of sizes 2, 3, 4, and 5. Y ou can the grid. 4 2 3 4 5 1 11 1 0 0 0 1 00 0 0 1 0 0 1 0 0 0 0 1 0 0 1 see the ships in 0 0 0 0 1 0 0 0

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 Databases Questions!