Advertisement
branden36077

Untitled

Mar 21st, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.30 KB | None | 0 0
  1. import java.util.Scanner;
  2. import java.util.Random;
  3.  
  4. public class Rock_bp
  5. {
  6. public static void main(String[] args)
  7. {
  8. int input;
  9.  
  10. //user input
  11.  
  12. Scanner keyboard = new Scanner(System.in);
  13. Random rng = new Random ();
  14. System.out.println("Choose 1, 2, 3, 4, 5 for Rock, Paper, Scissors, Lizard, and Spock");
  15.  
  16. int rock = 1, paper = 2, scissors = 3, lizard = 4, spock = 5;
  17. input = keyboard.nextInt();
  18. int randomNumber = rng.nextInt(5-1)+1;
  19.  
  20.  
  21. //input rock
  22.  
  23. if(randomNumber == rock)
  24.  
  25. if(input == rock)
  26. {
  27. System.out.println("Rock vs Rock, it is a tie.");
  28. } else if(input == paper)
  29. {
  30. System.out.println("Rock vs Paper. You win!");
  31. } else if(input == scissors)
  32. {
  33. System.out.println("Rock vs Sciccors. You lose.");
  34. } else if(input == lizard)
  35. {
  36. System.out.println("Rock vs Lizard. You lose.");
  37. } else if(input == spock)
  38. {
  39. System.out.println("Rock vs Spock. You win!");
  40. }
  41. //input paper
  42. if(randomNumber == paper)
  43.  
  44. if(input == paper)
  45. {
  46. System.out.println("Paper vs Rock. You lose.");
  47. } else if(input == paper)
  48. {
  49. System.out.println("Paper vs Paper. It is a tie.");
  50. } else if(input == scissors)
  51. {
  52. System.out.println("Paper vs Sciccors. You win!");
  53. } else if(input == lizard)
  54. {
  55. System.out.println("Paper vs Lizard. You Win!");
  56. } else if(input == spock)
  57. {
  58. System.out.println("Paper vs Spock. You lose.");
  59. }
  60. //input scissors
  61. if(randomNumber == scissors)
  62.  
  63. if(input == scissors)
  64. {
  65. System.out.println("Scissors vs Rock. You Win!");
  66. } else if(input == paper)
  67. {
  68. System.out.println("Scissors vs Paper. You lose.");
  69. } else if(input == scissors)
  70. {
  71. System.out.println("Scissors vs Sciccors. It is a tie.");
  72. } else if(input == lizard)
  73. {
  74. System.out.println("Scissors vs Lizard. You Lose.");
  75. } else if(input == spock)
  76. {
  77. System.out.println("Scissors vs Spock. You Win!");
  78. }
  79. //input lizard
  80. if(randomNumber == lizard)
  81.  
  82. if(input == lizard)
  83. {
  84. System.out.println("Lizard vs Rock. You Win!");
  85. } else if(input == paper)
  86. {
  87. System.out.println("Lizard vs Paper. You lose.");
  88. } else if(input == scissors)
  89. {
  90. System.out.println("Lizard vs Sciccors. You win!");
  91. } else if(input == lizard)
  92. {
  93. System.out.println("Lizard vs Lizard. It is a tie.");
  94. } else if(input == spock)
  95. {
  96. System.out.println("Lizard vs Spock. You lose.");
  97. }
  98. //input spock
  99. if(randomNumber == spock)
  100.  
  101. if(input == spock)
  102. {
  103. System.out.println("Spock vs Rock. You lose.");
  104. } else if(input == paper)
  105. {
  106. System.out.println("Spock vs Paper. You win!");
  107. } else if(input == scissors)
  108. {
  109. System.out.println("Spock vs Sciccors. You Lose.");
  110. } else if(input == lizard)
  111. {
  112. System.out.println("Spock vs Lizard. You Win!");
  113. } else if(input == spock)
  114. {
  115. System.out.println("Spock vs Spock. It is a tie.");
  116. }
  117. }
  118. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement