Professional Documents
Culture Documents
*;
public class MoreStringPractice
{
public static void main (String [] args)
{
Scanner keyboard = new Scanner(System.in);
System.out.print("Enter a full name: ");
String full = keyboard.nextLine();
full = full.trim(); // get rid of leading/trailing spaces
String first = "";
String last = "";
int commaPosition = full.indexOf(",");
int space = full.indexOf(" ");
//
= "computer";
1)
= "purple";
2)
= "algorithm";
3)
= "heuristic";
{
System.out.println("Good guess!");
}
userWord = result;
}
}
if (errors > 5) // lost the game
{
System.out.println("YOU LOSE!");
}
else
{
System.out.println("Congratulations. You won... this tim
e.");
}
}
}