Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class DotCom{
- private ArrayList<String> locationCells;
- private String name;
- public void setLocationCells(ArrayList<String> loc){
- locationCells=loc;
- }
- public void setName(String n){
- name=n;
- }
- public String checkYourself(String userInput){
- String result="Мимо";
- int index = locationCells.indexOf(userInput);
- if (index>=0){
- locationCells.remove(index);
- if (locationCells.isEmpy()){
- result="Потопил";
- System.out.println("Вы потопили: " + name);
- }
- else result = "Попал";
- }
- return result;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement