Develop a Java program that checks the advisability of going to the beach based on the current weather conditions. The program will receive three boolean inputs in sequence: isSunny, isRainy, and isCold. Your program should output 'true' if the weather is sunny and not rainy or cold, and 'false' otherwise.
Boolean type and operations. True and false
Is it a Beach Day? Check the Skies!
Report a typo
Sample Input 1:
true
false
falseSample Output 1:
trueSample Input 2:
false
true
trueSample Output 2:
falseWrite a program in Java 25
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
boolean isSunny = scanner.nextBoolean();
boolean isRainy = scanner.nextBoolean();
boolean isCold = scanner.nextBoolean();
// Calculate and print decision
scanner.close();
}
}
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.