Posts

Showing posts with the label Java Program

Java program to play Rock, Paper and Scissors with computer.

Image
import java.lang.*; import java.util.Scanner; import java.util.Random; public class RPS{          public int user_score =0 , comp_score = 0;     public String user_choice, comp_choice;     Random ran;     Scanner scan;     public RPS(){         ran = new Random();         scan = new Scanner(System.in);     }     public void userTurn(){         System.out.println("\n[1] Rock , [2] Paper , [3] Scissors");         System.out.print("Choice > ");         user_choice = whatIsIt(scan.nextInt() - 1);     }     public void machineTurn(){         comp_choice = whatIsIt(ran.nextInt(3) + 1);     }     public Str...

JAVA | Check by ASCII weather a single input character is vowel or consonant?

Image
PRACTICE AND LEARN  JAVA                          (ASCII, Input a character)