Question
You are programming the behavior of an enemy in a video game. The enemy code has access to two boolean variables, canSeePlayer and playerPoweredUp. canSeePlayer
You are programming the behavior of an enemy in a video game. The enemy code has access to two boolean variables, canSeePlayer and playerPoweredUp. canSeePlayer is true when the enemy can see the player and false otherwise, and playerPoweredUp is true when the player has found a special item that makes them impossible to defeat temporarily. Fill in the correct conditions so that Attack!" is printed when the enemy can see the player and the player is not powered-up, Run away!" is printed when the player is visible and is powered-up, and finally, Wander." is printed if the player is not visible.
Starting code:
if ( ) {
if ( ) {
System.out.println("Attack!");
} else {
System.out.println("Run away!");
}
} else {
System.out.println("Wander.");
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started