Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package rps;
- import java.util.Random;
- import java.util.Scanner;
- /**
- *
- * @author Student-HSLH133
- */
- public class Rps {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- String O = "";
- Random random = new Random();
- Scanner input = new Scanner(System.in);
- int C = random.nextInt(3);
- System.out.println(C);
- if (C == 0) {
- O.equals("rock");
- } else if (C == 1) {
- O.equals("paper");
- } else if (C == 2) {
- O.equals("scissors");
- }
- String I = input.next();
- I.toLowerCase();
- if (I.equals(O)) {
- System.out.println("tie");
- } else if (I.equals("rock") && O.equals("scissors")) {
- System.out.println("you win");
- } else if (I.equals("rock") && O.equals("paper")) {
- System.out.println("you lose");
- } else if (I.equals("paper") && O.equals("scissors")) {
- System.out.println("you win");
- } else if (I.equals("paper") && O.equals("rock")) {
- System.out.println("you lose");
- } else if (I.equals("scissors") && O.equals("paper")) {
- System.out.println("you win");
- } else if (I.equals("scissors") && O.equals("rock")) {
- System.out.println("you lose");
- }
- if (C == 0) {
- System.out.println("I chose Rock");
- } else if (C == 1) {
- System.out.println("I chose Paper");
- } else if (C == 2) {
- System.out.println("I chose Scissors");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement