Question: (Java) Evaluating and Setting Booleans Using If-Else Let's use booleans to figure out if it's a good day today. There are a few boolean variables
(Java) Evaluating and Setting Booleans Using If-Else
Let's use booleans to figure out if it's a good day today. There are a few boolean variables that have already been initialized for you: - boolean sunny - boolean ateIceCream - boolean hadHomework - boolean isGoodDay The first three booleans (sunny, ateIceCream, hadHomework) are for you to check their values. Depending on their values, you will assign the boolean isGoodDay to be either true or false, and then print it out to console. Here are the rules: - No matter what, if you ate ice cream, then it's a good day! - If it's sunny and you didn't have any homework, then it's a good day! - Otherwise, it wasn't sunny and/or you had homework, so it's not a good day...
// boolean sunny, ateIceCream, and hadHomework have already been declared and set! //boolean isGoodDay; // TODO: add your code here
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
