Advertisement
Guest User

Untitled

a guest
Feb 27th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package rps;
  7.  
  8. import java.util.Random;
  9. import java.util.Scanner;
  10.  
  11. /**
  12. *
  13. * @author Student-HSLH133
  14. */
  15. public class Rps {
  16.  
  17. /**
  18. * @param args the command line arguments
  19. */
  20. public static void main(String[] args) {
  21.  
  22. String O = "";
  23. Random random = new Random();
  24. Scanner input = new Scanner(System.in);
  25.  
  26.  
  27.  
  28. int C = random.nextInt(3);
  29. System.out.println(C);
  30.  
  31. if (C == 0) {
  32. O.equals("rock");
  33. } else if (C == 1) {
  34. O.equals("paper");
  35. } else if (C == 2) {
  36. O.equals("scissors");
  37. }
  38.  
  39. String I = input.next();
  40. I.toLowerCase();
  41.  
  42.  
  43.  
  44.  
  45.  
  46. if (I.equals(O)) {
  47. System.out.println("tie");
  48. } else if (I.equals("rock") && O.equals("scissors")) {
  49. System.out.println("you win");
  50. } else if (I.equals("rock") && O.equals("paper")) {
  51. System.out.println("you lose");
  52. } else if (I.equals("paper") && O.equals("scissors")) {
  53. System.out.println("you win");
  54. } else if (I.equals("paper") && O.equals("rock")) {
  55. System.out.println("you lose");
  56. } else if (I.equals("scissors") && O.equals("paper")) {
  57. System.out.println("you win");
  58. } else if (I.equals("scissors") && O.equals("rock")) {
  59. System.out.println("you lose");
  60. }
  61.  
  62. if (C == 0) {
  63. System.out.println("I chose Rock");
  64. } else if (C == 1) {
  65. System.out.println("I chose Paper");
  66. } else if (C == 2) {
  67. System.out.println("I chose Scissors");
  68. }
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76. }
  77.  
  78.  
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement