Question: JAVA SUMMATIVE ASSIGNMENT Create a one player version of Battleship in java in which the computer randomly generates 5 ships and the user has to

JAVA SUMMATIVE ASSIGNMENT

Create a one player version of Battleship in java in which the computer randomly generates 5 ships and the user has to try sinking the ships.

Overall, your summative must demonstrate use of all major programming constructs learned throughout this semester including:

Variables: Member variables, class variables, and constants

Input/Output: Standard input/output using sysout and scanners, or user controls with mouse/key listeners.

Loops: While and/or for as appropriate.

Arrays & Lists Standard arrays or wrapper classes such as the ArrayList.

Class Design: Re-using code in the form of classes with private member variables, set/get methods, and appropriate encapsulation.

If Statements: Controlling program flow and game state using if statements and appropriate variables.

Methods: Static or instance methods, both with and without return values and parameters.

EXAMPLE - Welcome to Battleship.

9 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

8 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

7 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

6 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

5 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

4 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

3 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

2 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

1 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

0 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

0 1 2 3 4 5 6 7 8 9

Enter a coordinate: 4 7

Hit!

9 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

8 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

7 ~ ~ ~ ~ X ~ ~ ~ ~ ~

6 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

5 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

4 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

3 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

2 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

1 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

0 ~ ~ ~ ~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