import java.util.Scanner; /** * The classic Game described at U of Washington Description: * https://sites.math.washington.edu/~mathcircle/mmc/mmc2010/PicoFermiBagel.pdf * @author cct * */ public class PicoFermiBagel { private Scanner kb; // the keyboard private int[] code; /** * Initialize */ public PicoFermiBagel() { kb = new Scanner(System.in); code = new int[3]; } public static int ask(String question) { System.out.print(question+" "); String answer = kb.nextLine(); return Integer.parseInt(answer); } public void makeNonRepeatingNumber() { // your code will put the random, non-repeating digits in code } /** * "Bagel" returned if no digit correct * "Pico" for every digit found in the wrong place * "Fermi" for every digit found in the right place * * A variant for small children is to give a clue for every digit * so " Bagel Bagel Bagel " would be returned if no digit is correct */ public String clue (int guess) { // your code here } public boolean correct(int guess) { // your code here return tur if they have a Fermi, Fermi, Fermi // flase otherwise } public static void main(String[] args) { System.out.print("Welcome to Pico, Fermi, Bagel!"); PicoFermiBagel game = new PicoFermiBagel(); int guess = ask("Guess a 3 digit number:"); System.out.println( game.clue(guess)+"\n" ); while (!game.correct(guess)) { guess = ask("Guess a 3 digit number:"); } } }