Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- import java.util.Scanner;
- public class ball {
- public static String question = "";
- public static void main(String[] args) {
- System.out.println("***** EGO admin 8 ball *****");
- ball();
- }
- private static void ball() {
- System.out.println("What is your question young admin?");
- Scanner scan = new Scanner(System.in);
- question = scan.nextLine();
- Random rand = new Random();
- int answer = rand.nextInt(8) + 1;
- String ret = "";
- switch(answer) {
- case 1:
- ret = "Blame Mayhem Death";
- break;
- case 2:
- ret = "Ask me later";
- break;
- case 3:
- ret = "I flipped a coin";
- break;
- case 4:
- ret = "Yes";
- break;
- case 5:
- ret = "No";
- break;
- case 6:
- ret = "I fat fingered your name";
- break;
- case 7:
- ret = "You're a troll";
- break;
- default:
- ret = "Ball broken, insert $1 to fix";
- }
- System.out.println("Question: " + question);
- System.out.println("Answer: " + ret);
- while(true) {
- System.out.println("Play again? 0 - no 1 - yes");
- Scanner answerScan = new Scanner(System.in);
- int response = answerScan.nextInt();
- if(response == 1) {
- ball();
- }
- else {
- System.exit(0);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment