8ball

import java.util.*; public class eightball { // instance variables - replace the example below with your own Scanner scan = new Scanner(System.in); public eightball() { boolean bool = true; String[] answ = {"Absolutely", "Answer Unclear Ask Later", "Cannot Foretell Now", "Can't Say Now", "Chances Aren't Good", "Consult Me Later", "Don't Bet On It", "Focus And Ask Again"}; while (bool == true){ int rand = (int)(Math.random() * 8) + 0; String q = scan.next(); if (q.equals("X")){ bool = false; } else{ System.out.println(answ[rand]); } } } }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.