Class Ship

java.lang.Object
  extended by Ship

public class Ship
extends java.lang.Object

George Smith CIS421 - Web Based Java December 7th, 2007 Project: Battleship v2.0 Description: The Ship class for the battle ship game that is used to store attributes about each ship


Field Summary
private  int active
           
private  int hp
           
private  int shipLength
           
private  java.lang.String shipName
           
private  java.lang.String shipSym
           
 
Constructor Summary
Ship(int type)
          The Ship class is used to setup the ship attributes and to store important information about them
 
Method Summary
 int getActive()
          Used to get the state of any ship
 int getShipHP()
          Used to get the current head points of the ship requested
 int getShipLength()
          Used to get the ship length of the ship requested
 java.lang.String getShipName()
          Used to get the name of the ship
 void hpLoss()
          Used to subtract headpoints for a given ship
 void setActive(int act)
          used to set the active of a ship
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

active

private int active

shipName

private java.lang.String shipName

shipLength

private int shipLength

hp

private int hp

shipSym

private java.lang.String shipSym
Constructor Detail

Ship

public Ship(int type)
The Ship class is used to setup the ship attributes and to store important information about them

Parameters:
type - - determines the type of ship to be setup
Method Detail

setActive

public void setActive(int act)
used to set the active of a ship

Parameters:
act - - the state of the ship, 0 for being sunk and 1 for being still alive

getActive

public int getActive()
Used to get the state of any ship

Returns:
returns the active state of ships

getShipLength

public int getShipLength()
Used to get the ship length of the ship requested

Returns:
returns the ship length for the ship

getShipName

public java.lang.String getShipName()
Used to get the name of the ship

Returns:
returns the name of the ship requested

getShipHP

public int getShipHP()
Used to get the current head points of the ship requested

Returns:
returns the current headpoints of the ship requested

hpLoss

public void hpLoss()
Used to subtract headpoints for a given ship