/* Name: Lukas Nikolau * Take Home Exam 01 * CS 201 */ import java.util.Scanner; public class Take_Home_Exam_01 { public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); String cPhrase = ""; //common phrase entered by the user String gPhrase = cPhrase; String guess = ""; //guess entered by the user System.out.println("Please enter the phrase to guess at : "); cPhrase = stdIn.nextLine(); for (int x = 0; x < cPhrase.length(); x++) { gPhrase += cPhrase.charAt(x) == ' '? ' ' : '?'; } while (gPhrase != cPhrase) { System.out.print('\r' + "Common Phrase" + '\r' + "_____________" + '\r' + '\r' + "Enter a lowercase letter guess: "); guess = stdIn.nextLine(); for (int x = 0; x < cPhrase.length(); x++) { int i; i = Integer.parseInt(guess); gPhrase += cPhrase.charAt(x) == ' '? ' ' : 'i'; } } System.out.print('\r' + "Common Phrase" + '\r' + "_____________" + '\r' + gPhrase); } }