I need to solve this exercise using java code:
We have a monkey and a boolean parameter aSmile, we need to know if the monkey is smiling and if it is "We are in trobule" if it is not "We are good".
import java.util.Scanner;
public class taxi {
public static void main(String[] args) {
boolean aSmile;
Scanner scan = new Scanner(System.in);
System.out.println("Is monkey A smiling?");
String answer = scan.nextLine();
if (answer.equalsIgnoreCase("yes")){
aSmile = true;
}
else if (answer.equalsIgnoreCase("no")){
aSmile = false;
}
else {
System.out.println("Sorry, write a correct answer");
}
if(aSmile = true){
System.out.println("We are in trouble");
}
else if (aSmile = false){
System.out.println("We are good!");
}
}
}
The problem is that I always get "We are in trobule", no matter what I write in the console.