import java.applet.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Random; public class Main extends Applet implements ActionListener{ Label mainLbl; Label chooseLbl; Label resultsLbl; Label result1; Label result2; Label result3; Button btnRock; Button btnPaper; Button btnScissor; public static final int RESULT_ROCK = 1; public static final int RESULT_PAPER = 2; public static final int RESULT_SCISSOR = 3; int userWin = 0; int systemWin =0; int tie; @Override public void init() { // TODO Auto-generated method stub super.init(); setLayout(null); //Add UI mainLbl = new Label(\"Rock, Papers, Scissors\"); mainLbl.setFont(new Font(\"TimesRoman\", Font.BOLD, 25)); mainLbl.setBounds(50, 30, 500, 30); add(mainLbl); chooseLbl = new Label(\"Choose one Button\"); chooseLbl.setFont(new Font(\"TimesRoman\", Font.BOLD, 15)); chooseLbl.setBounds(20, 70, 170, 20); add(chooseLbl); btnRock = new Button(\"Rock\"); btnRock.setBounds(200, 70, 70, 30); btnRock.addActionListener(this); add(btnRock); btnPaper = new Button(\"Papers\"); btnPaper.setBounds(270, 70, 80, 30); btnPaper.addActionListener(this); add(btnPaper); btnScissor = new Button(\"Scissors\"); btnScissor.setBounds(350, 70, 80, 30); btnScissor.addActionListener(this); add(btnScissor); resultsLbl = new Label(\"---- Results---\"); resultsLbl.setFont(new Font(\"TimesRoman\", Font.BOLD, 15)); resultsLbl.setBounds(100, 110, 170, 20); add(resultsLbl); result1 = new Label(); result1.setFont(new Font(\"TimesRoman\", Font.BOLD, 12)); result1.setBounds(20, 140, 300, 20); add(result1); result2 = new Label(); result2.setFont(new Font(\"TimesRoman\", Font.BOLD, 12)); result2.setBounds(20, 170, 300, 20); add(result2); result3 = new Label(); result3.setFont(new Font(\"TimesRoman\", Font.BOLD, 12)); result3.setBounds(20, 200, 300, 20); add(result3); } public void paint(Graphics g){ this.setSize(500, 330); g.drawString(\"Name : You\ Id : 200 \ \",40,300); } @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub Random r = new Random(); //get system choice randomly int syschoice = 0; syschoice = (int)(Math.random() * ((3 - 1) + 1)) + 1; //get Answer Randomly int answer = 0; answer = (int)(Math.random() * ((3 - 1) + 1)) + 1; int userChoice = 0; if(e.getSource() == btnRock){ userChoice = RESULT_ROCK; } else if(e.getSource() == btnPaper){ userChoice = RESULT_PAPER; } else if(e.getSource() == btnScissor){ userChoice = RESULT_SCISSOR; } String Winner = null; if(userChoice == answer){ Winner = \"Winner : You\"; userWin++; } else if(syschoice == answer){ Winner = \"Winner : System\"; systemWin++; } else{ Winner = \"Winner : Tie\"; tie++; } result2.setText(Winner); String choice = \"You Picked \"+choiceFrmInt(userChoice)+\"---- System Picked \"+choiceFrmInt(syschoice); result1.setText(choice); String result = \"You : \"+userWin+ \" System: \"+systemWin + \"Tie : \"+tie; result3.setText(result); } private String choiceFrmInt(int choi.