Question
In this assignment, you will practice developing UML Class diagrams to describe system elements and structure, and will practice writing code that conforms to the
In this assignment, you will practice developing UML Class diagrams to describe system elements and structure, and will practice writing code that conforms to the class diagram. You can draw UML Class Diagrams by hand, or by using any software tool of your choosing.
The Battle Ship game is played with two players. Each game has a number of properties, such as start time, end time, type of game (two human players, or one human and one computer player). A player, can be either a human being or a computer. Each game must have at least one human player. Every player has exactly 45 torpedoes to throw at enemy waters. Each torpedo has two coordinates, x and y.
Each player has 6 ships to position on the grid. Ships have different size and value. The game is composed of many rounds. At each round, a player throws one torpedo and can view the results. If the torpedo hits a ship, then the player can throw a second torpedo. This goes on until there are no torpedoes left, or when
one player has lost all his ships. The game has one of two possible outcomes; one of the two
players can win, or it can be a tie.
Players collects points. For every game won, the player collects two points, and for a tie the player collects only one point.
Part 1:
Draw a UML class diagram that covers all the elements of the Battle Ship game as
described above. A complete class diagram should depict the following:
a)All classes, their attributes and methods, if any.
b)All associations and their multiplicities
c)Association names
d)Role names
A good class diagram is also one that has a good layout and is easy to understand.
Part 2:
Use your design in part one and implement it in Java. Your implementation should cover the following elements at minimum:
a)Implementation of all classes and associations.
b)Each class should include all required attributes.
c)Each class should implement two methods; add and remove. Add method creates a new object and add it to the association, and remove method removes objects from the association. These two methods must not violate the association multiplicities. If a violation occurs, the method should report an error to the user.
d)Each class should implement a method to list all objects participating in the association.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started