Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class Guessing
  3. {
  4. public static void main(String args[]) throws java.io.IOException
  5. {
  6. System.out.println("Welcome to the Guessing Game!\n\nA if this is your first time.\nB if you are just a bit into the season.\nC if you think you have what its got.\nQ if you cannot take it.");
  7.  
  8. Scanner scan = new Scanner(System.in);
  9. char choice = scan.next().charAt(0);
  10.  
  11. if(choice == 'A' || choice == 'a')
  12. {
  13. System.out.println("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
  14. System.out.println("You have chosen the way of the weak. You have no limit in choices.");
  15. {
  16. int ans;
  17. { ans = (int)(Math.random() * 10 + 1);
  18. do{
  19. int resp = scan.nextInt();
  20. {
  21.  
  22. if(resp == ans)
  23. {
  24. System.out.println("Good job!");
  25. }
  26. if(resp > ans)
  27. {
  28. System.out.println("A little to big");
  29. }
  30. if (resp < ans)
  31. {
  32. System.out.println("A little to small");
  33. }
  34. }while(resp != ans);
  35.  
  36. }
  37.  
  38. }
  39.  
  40.  
  41. }
  42. if else(choice == 'Q' || choice == 'q')
  43. {
  44. System.exit(0);
  45. }
  46. }
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement