-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPaperGame.java
More file actions
38 lines (37 loc) · 1.19 KB
/
PaperGame.java
File metadata and controls
38 lines (37 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.example;
import java.util.Scanner;
public class PaperGame {
public static void main(String args[]){
System.out.println("WELCOME ROCK,PAPER SCISSOR GAME \n!!!! ENJOY !!!!");
System.out.println("ROCK'S NUMBER : 2");
System.out.println("PAPER'S NUMBER : 1");
System.out.println("SCISSOR'S NUMBER : 0");
while(1==1){
int computerNumber = (int)(Math.random()*3);
System.out.print("Enter a number : ");
Scanner input = new Scanner(System.in);
int yourNumber = input.nextInt();
if(computerNumber == 0)
System.out.print("Computer is Scissor");
else if(computerNumber == 1)
System.out.print("Compter is Paper");
else
System.out.print("Computer is Rock");
if(yourNumber == 0)
System.out.println(" Your are Scissor ");
else if(yourNumber == 1)
System.out.println(" Your are Paper ");
else
System.out.println(" Your are Rock ");
if(computerNumber == yourNumber){
System.out.println("Draw the game ");
}
else if(computerNumber < yourNumber){
System.out.println("You WON !!!\nGAME OVER");
break;
}
else
System.out.println("You Lost \nTry One Time keep it up !");
}
}
}