GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Java/Programs/RockPaperScissor.java at main · arshcoder13/Java Expand file tree/ Copy pathRockPaperScissor.javaMore file actions 30 lines (24 loc) · 1017 Bytes / Copy pathRockPaperScissor.javaFile metadata and controls30 lines (24 loc) · 1017 Bytes 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 import java.util.Random; import java.util.Scanner; public class Rockpaperscissor { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Choose Any One:\n1. Rock \n2. Paper \n3. Scissor"); int user = sc.nextInt(); if (user > 3 || user < 1) { System.out.println("Plz type valid input"); return; } Random random = new Random(); int computer = random.nextInt(1, 4); System.out.println("YOU CHOOSE: "+user); System.out.println("Computer Choose: "+computer); if (user == 1 && computer == 1 || user == 2 && computer == 2 || user == 3 && computer == 3) { System.out.println("Match Tie"); } else if (user == 1 && computer == 3 || user == 2 && computer == 1 || user == 3 && computer == 2) { System.out.println("Hurray! YOU WIN"); } else { System.out.println("Better luck next Time: Computer WIN"); } } } |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |