Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

0 1 2 3 4 5 6 7 8 9

Enter a coordinate: 5 6

Miss.

9 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

8 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

7 ~ ~ ~ ~ X ~ ~ ~ ~ ~

6 ~ ~ ~ ~ ~ . ~ ~ ~ ~

5 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

4 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

3 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

2 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

1 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

0 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

0 1 2 3 4 5 6 7 8 9

Enter a coordinate:

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

Students also viewed these Databases questions

Question

Repeat Problem 9143 using argon as the working fluid.

Answered: 1 week ago