GameNCode

Magic 8 Ball

May 22nd, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.84 KB | None | 0 0
  1. /**
  2. * Created by RoyW on 5/22/2016.
  3. */
  4.  
  5.  
  6. //Imports
  7.  
  8. import java.util.Scanner;
  9.  
  10. public class Main {
  11.  
  12. public static void main(String[] args) {
  13.  
  14. while (true) {
  15. Scanner userInput = new Scanner(System.in);
  16. double Random = Math.random();
  17. System.out.println("Ask me any Yes or No question");
  18. System.out.println();
  19. String User = userInput.nextLine();
  20.  
  21. System.out.println();
  22. System.out.println("The answer I have for you is this: ");
  23. System.out.println();
  24.  
  25. if (Random < 0.05) {
  26. System.out.println("It is certain");
  27. } else if (Random < 0.1 && Random > 0.05) {
  28. System.out.println("It is decidedly so");
  29. } else if (Random < 0.15 && Random > 0.1) {
  30. System.out.println("Without a doubt");
  31. } else if (Random < 0.2 && Random > 0.15) {
  32. System.out.println("Yes, definitely");
  33. } else if (Random < 0.25 && Random > 0.2) {
  34. System.out.println("You may rely on it");
  35. } else if (Random < 0.3 && Random > 0.25) {
  36. System.out.println("As I see it, yes");
  37. } else if (Random < 0.35 && Random > 0.3) {
  38. System.out.println("Most likely");
  39. } else if (Random < 0.4 && Random > 0.35) {
  40. System.out.println("Outlook good");
  41. } else if (Random < 0.45 && Random > 0.4) {
  42. System.out.println("Yes");
  43. } else if (Random < 0.5 && Random > 0.45) {
  44. System.out.println("Signs point to yes");
  45. } else if (Random < 0.55 && Random > 0.5) {
  46. System.out.println("Reply hazy try again");
  47. } else if (Random < 0.6 && Random > 0.55) {
  48. System.out.println("Ask again later");
  49. } else if (Random < 0.65 && Random > 0.6) {
  50. System.out.println("Better not tell you now");
  51. } else if (Random < 0.7 && Random > 0.65) {
  52. System.out.println("Cannot predict now");
  53. } else if (Random < 0.75 && Random > 0.7) {
  54. System.out.println("Concentrate and ask again");
  55. } else if (Random < 0.8 && Random > 0.75) {
  56. System.out.println("Don't count on it");
  57. } else if (Random < 0.85 && Random > 0.8) {
  58. System.out.println("My reply is no");
  59. } else if (Random < 0.9 && Random > 0.85) {
  60. System.out.println("My sources say no");
  61. } else if (Random < 0.95 && Random > 0.9) {
  62. System.out.println("Outlook not so good");
  63. } else if (Random < 1 && Random > 0.95) {
  64. System.out.println("Very doubtful");
  65. }
  66. System.out.println();
  67.  
  68. }
  69. }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment