All pastes #2092930 Raw Edit

Mine

public text v1 · immutable
#2092930 ·published 2011-11-08 04:43 UTC
rendered paste body
/* 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 < gPhrase.length(); x++)
			{
				gPhrase += guess.charAt(x);
			}
		}
		
		System.out.println(gPhrase);
	    
	}

}