Guest User

Untitled

a guest
Oct 22nd, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.79 KB | None | 0 0
  1. import javax.swing.JOptionPane;
  2. import java.util.Random;
  3. public class CompatibilityChecker
  4. {
  5.     public static void main(String[] args)
  6.     {
  7.        
  8.     String userInput1 = JOptionPane.showInputDialog("Rock, Paper, or Scissors?");
  9.     if (userInput1 == "Rock"){
  10.         int Input1 = 0;}
  11.     else if (userInput1 == "Paper"){
  12.         int Input1 = 1;}
  13.     else if (userInput1 == "Scissors"){
  14.         int Input1 = 2;}
  15.     Random otherRandom = new Random();
  16.     int myRandom = otherRandom.nextInt(3);
  17.     if (myRandom == 0){
  18.         String opResult = "Rock";}
  19.         else if (myRandom == 1){
  20.             String opResult = "Paper";}
  21.         else if (myRandom == 2){
  22.             String opResult = "Scissors";}
  23.     if (Input1 = myRandom){
  24.         System.out.println("Tie, your opponent chose " + opresult);
  25.     }
  26.    
  27.     }    
  28. }
Add Comment
Please, Sign In to add comment