FileDocCategorySizeDatePackage
DotCom.javaAPI DocExample915Tue Mar 22 20:02:32 GMT 2005None

DotCom

public class DotCom extends Object

Fields Summary
private ArrayList
locationCells
private String
name
Constructors Summary
Methods Summary
public java.lang.StringcheckYourself(java.lang.String userInput)

 
      String result = "miss";
      int index = locationCells.indexOf(userInput);      
      if (index >= 0) {                              
          locationCells.remove(index);
         
         if (locationCells.isEmpty()) {
             result = "kill";
             System.out.println("Ouch! You sunk " + name + "  : ( ");
         } else {
             result = "hit";
         }  // close if                       
      } // close if            
       return result;

   
public voidsetLocationCells(java.util.ArrayList loc)

      locationCells = loc;
   
public voidsetName(java.lang.String n)

      name = n;