import java.io.*; public class meth { private static int r=0; private static int q=0; private static int b; private static int y; private static int hg;//Random Number private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static public void main(String[]haha)throws Exception { int a=0;//Guess Result System.out.println(g()); //g(); //do{ while(a!=31) { q++; try { System.out.println("Guess a Number"); b=Integer.parseInt(br.readLine());//Random Guess a=f(b);//Check Guess,Random Guess } catch(Exception e) { r++; System.out.println("Invalid Input"); } } }//while(cx(true));} public static int g()//Get Random Number { hg = (int)(Math.random()*31);//Random Number return hg; } public static int f(int y)//Check Guess,Guess { if(y>hg) { System.out.println("Lower"); return y; } else if(y<hg) { System.out.println("Higher"); return y; } else if(y<0) { System.out.println("Negative Number is not Allowed"); return -0; } else if(y==hg) { System.out.println("Yes The Random Number is: "+hg); System.out.println("Number of Tries: "+q); if(q==1) { System.out.println("Bravo It's Free"); q=0; System.out.println(q); } int v=q*50; int k=r*30; int c=k+v; System.out.println("Please Pay: "+v+" For Wrong Guess"); System.out.println("Please Pay: "+k+" For Wrong Input"); System.out.println("Please Pay: "+c+" Overall"); return 31; } else { return y; } } public static boolean cx(boolean ay)throws Exception { System.out.println("Try Again Y or N?"); String i=br.readLine(); if(i.equalsIgnoreCase("y")) { ay=true; return true; } else if(i.equalsIgnoreCase("n")) { ay=false; return false; } else { ay=false; return false; } } }