Game of battleship some method problems
<p>I have a working position class that works fine.
now I need finish up my ship class.</p>

<p>The method "onBoat" takes in a position and check if that position is where the boat is.
it works fine when i test it.</p>

<pre><code>public boolean onBoat(Position onBoat) {
   if (direction.equals("HORIZONTAL")) {
      for (int x = 0; size &gt; x; x++) {
          if (position.Row().equals(onBoat.Row()) &amp;&amp; position.Colume()+x == onBoat.Colume()) {
              return true;
          }
      }
   } else if (direction.equals("VERTICAL")) {
       for (int x = 0; size &gt; x; x++) {
           if (position.rowIndex()+x == (onBoat.rowIndex()) &amp;&amp; position.Colume() == onBoat.Colume()) {
              return true;
           }
       }
   }
   return false;
}
</code></pre>

<p>I have problem on the "hit" and "isHit" methods
for my hit method I check to see if the position is "onBoat"
if so then return true else is false.</p>

<pre><code>public boolean hit(Position hit) {
    if (onBoat(hit) == true) {
        return true;
    }
    return false;
}
</code></pre>

<p>And for the isHit method I check to see if Hit is true
return true if so else is false.</p>

<pre><code>public boolean isHit(Position isHit) {
    if (hit(isHit) == true) {
       return true;
    }
    return false;
}
</code></pre>

<p>When I test it. Whether the boat is hit or not. If it is on the boat it returns true
can someone help me fix this.
I think its a pretty simple problem but my mind just cant get around it.</p>
