Advertisement
ZhenghaoZhu

Magic8Ball

Jan 11th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.14 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class Magic8Ball{
  4.   public static void main(String []args){
  5.     Scanner input = new Scanner(System.in);
  6.     System.out.println("*****************************");
  7.     System.out.println("*****************************");
  8.     System.out.println("***Welcome to Magic 8 Ball***");
  9.     System.out.println("*****************************");
  10.     System.out.println("*****************************");  
  11.     System.out.println("What is your question?");
  12.     String question = input.nextLine();  
  13.     int die1 = (int)(Math.random()*20+1);
  14.     String[] answers = {"Zero","It is certain", "It is decidedly so", "Without a doubt", "Yes, definitely", "You may rely on it", "As I see it, yes", "Most likely", "Outlook good", "Yes", "Signs point to yes", "Reply hazy try again", "Ask again later", "Better not tell you now", "Cannot predict now", "Concentrate and ask again", "Don't count on it", "My reply is no", "My sources say no", "Outlook not so good", "Very doubtful"};
  15.     System.out.println(question);
  16.     if(die1==1)
  17.       System.out.println(answers[1]);
  18.     if(die1==2)
  19.       System.out.println(answers[2]);
  20.     if(die1==3)
  21.       System.out.println(answers[3]);
  22.     if(die1==4)
  23.       System.out.println(answers[4]);
  24.     if(die1==5)
  25.       System.out.println(answers[5]);
  26.     if(die1==6)
  27.       System.out.println(answers[6]);
  28.     if(die1==7)
  29.       System.out.println(answers[7]);
  30.     if(die1==8)
  31.       System.out.println(answers[8]);
  32.     if(die1==9)
  33.       System.out.println(answers[9]);
  34.     if(die1==10)
  35.       System.out.println(answers[10]);
  36.     if(die1==11)
  37.       System.out.println(answers[11]);
  38.     if(die1==12)
  39.       System.out.println(answers[12]);
  40.     if(die1==13)
  41.       System.out.println(answers[13]);
  42.     if(die1==14)
  43.       System.out.println(answers[14]);
  44.     if(die1==15)
  45.       System.out.println(answers[15]);
  46.     if(die1==16)
  47.       System.out.println(answers[16]);
  48.     if(die1==17)
  49.       System.out.println(answers[17]);
  50.     if(die1==18)
  51.       System.out.println(answers[18]);
  52.     if(die1==19)
  53.       System.out.println(answers[19]);
  54.     if(die1==20)
  55.       System.out.println(answers[20]);
  56.    
  57.   }
  58.  
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement