Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.JOptionPane;
- import java.util.Random;
- public class CompatibilityChecker
- {
- public static void main(String[] args)
- {
- String userInput1 = JOptionPane.showInputDialog("Rock, Paper, or Scissors?");
- if (userInput1 == "Rock"){
- int Input1 = 0;}
- else if (userInput1 == "Paper"){
- int Input1 = 1;}
- else if (userInput1 == "Scissors"){
- int Input1 = 2;}
- Random otherRandom = new Random();
- int myRandom = otherRandom.nextInt(3);
- if (myRandom == 0){
- String opResult = "Rock";}
- else if (myRandom == 1){
- String opResult = "Paper";}
- else if (myRandom == 2){
- String opResult = "Scissors";}
- if (Input1 = myRandom){
- System.out.println("Tie, your opponent chose " + opresult);
- }
- }
- }
Add Comment
Please, Sign In to add comment