public class Boat { @SuppressWarnings("unused") private boolean Sunk = false; private String Ship; private Position Pos; private String Orientation; private int hits[]; private Position locs[]; Boat(String ship, Position pos, String orientation){ Ship = ship; Pos = pos; Orientation = orientation; int a = size(); hits = new int[a]; locs = new Position[a]; if(Orientation == "vertical"){ for(int count = 0; count= boatStart && target <= boatEnd){ target = target-boatStart; if(hits[target]==1){ return true; } } } }else if(Orientation == "horizontal"){ int target = pos.column(); int boatStart = Pos.column(); int boatEnd = boatStart+(size()-1); if(Pos.row()==pos.row()){ if(target >= boatStart && target <= boatEnd){ target = target-boatStart; if(hits[target]==1){ return true; } } } } return false; } public void hit(Position pos){ if(onBoat(pos)==true && isHit(pos)==false){ if(Orientation == "vertical"){ hits[pos.row()-Pos.row()] = 1; }else if(Orientation == "horizontal"){ hits[pos.column()-Pos.column()] = 1; } } } public boolean sunk(){ for(int count=0; count