EightBall(better)

import java.util.*; public class MagicBall { String[] responses = {"I would be suprised", "My visions say Yes", "Of course not", "Maybe", "Nope", "Probably", "Are you dumb?"}; boolean again = true; public MagicBall() { while(again = true){ System.out.println("Enter Your Question, press k to exit"); Scanner sc = new Scanner(System.in); String question = sc.next(); if(question.equals("k")) break; int answer = (int)(Math.random() * 7); String theresponse = responses[answer]; System.out.println(theresponse); } } }

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.