i need a taking turn method for a player vs computer battleship game in java. when a user slects on players board then computer should be able to pick one on the computer board. this should continue to repeat the order until the first one finds all the ship on their board first. Solution import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.*; import java.io.*; import java.lang.Integer; import java.util.Vector; import java.net.*; public class Battleship extends JFrame { private static JButton ok = new JButton(\"OK\"),//closes stats menu done =new JButton(\"Done\");//closes options menu private static JFrame statistics= new JFrame(\"Statistics\"),//holds stats options=new JFrame(\"Options\");//holds opts private static JLabel data,//used for stats menu title;//used for options menu private static JPanel stats=new JPanel(),//used for stats menu opts,//used for options menu inputpanel;//for manually inputting ships private static Container b,c,d;//board and input panel private JPanel input;//input bar private static JMenuItem m,pvp,pvc,cvc;//menu items private static String[] cletters = {\" \",\"A\",\"B\",\"C\",\"D\",\"E\",\"F\",\"G\",\"H\",\"I\",\"J\"}, //array of letters used for combo boxes cnumbers = {\" \",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\"}, //array of numbers used for combo boxes ships = {\"Carrier\",\"Battleship\",\"Submarine\",\"Destroyer\", \"Patrol Boat\"},//strings used for ship combo box direction = {\"Horizontal\",\"Vertical\"},//directions level={\"Normal\", \"Ridiculously Hard\"}, layout={\"Manual\",\"Automatic\"}, colors={\"Cyan\", \"Green\", \"Yellow\", \"Magenta\", \"Pink\", \"Red\", \"White\"}, first={\"Player 1\", \"Player 2\", \"Random\"};//used for options private JComboBox cshi = new JComboBox(ships),//ships cdir = new JComboBox(direction);//directions private static JComboBox aiLevel=new JComboBox(level), shipLayout=new JComboBox(layout), shipColor=new JComboBox(colors), playsFirst=new JComboBox(first);//used //for options menu private JTextField mbar = new JTextField();//message bar private static int enemy=1, i,j,//counters length=5, you=0, prevcolor=0,//index of previous color prevFirst=0, prevLayout=0, prevLevel=0,//tracks changes in corresponding comboboxes ready=0, sindex=0,//stores index of array dindex=0;//direction private static Player players[]=new Player[2]; private static JButton deploy=new JButton(\"DEPLOY\"); private static int w=0,a=0,s=0,t=0,e=0;//counters to track the use of all ships private static String[][] shiphit=new String[10][10]; private static String user,user2; private static Color[] color={Color.cyan,Color.green,Color.yellow,Color.magenta, Color.pink, Color.red, Color.white}; private static Object selectedValue=\" \", gametype; private static BattleshipClient me; private static boolean gameover=false; public Battleship() { setTitle(\"Battleship\"); setDefaultCloseOperation(EXIT_ON_CLOSE); setJMenuBar(createMenuBar()); setResizabl.