Is it a Beach Day? Check the Skies!

Report a typo

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.

Sample Input 1:

true
false
false

Sample Output 1:

true

Sample Input 2:

false
true
true

Sample Output 2:

false
Write 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