String Manipulation
String Manipulation
*;
class Guessmybrief{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int attempts = 1;
boolean guessed = false;
if (word.indexOf(guess) == -1) {
attempts++;
System.out.println("Wrong guess! You have " + (4 - attempts) + "
attempts left.");
} else {
char[] hiddenArray = hidden.toCharArray();
for (int i = 0; i < word.length(); i++) {
if (word.charAt(i) == guess) {
hiddenArray[i] = guess;
}
}
hidden = String.valueOf(hiddenArray);
}
if (hidden.equals(word)) {
guessed = true;
System.out.println("Congratulations! You guessed the color of my
brief word: " + word);
}
}
if (!guessed) {
System.out.println("Sorry, wala na!! ang sagot kasi ay " + word);
}
}
}