Develop a Java program that simulates a weather station giving personalized clothing recommendations based on the current weather conditions. The program must utilize if/else statements to determine appropriate clothing based on temperature, wind speed, and precipitation

1 answer

Sure! Here's an example of a Java program that simulates a weather station and gives clothing recommendations based on the current weather conditions:

```java
import java.util.Scanner;

public class WeatherStation {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);

System.out.print("Enter the current temperature in Celsius: ");
double temperature = input.nextDouble();

System.out.print("Enter the current wind speed in km/h: ");
double windSpeed = input.nextDouble();

System.out.print("Is it currently raining? (true/false): ");
boolean isRaining = input.nextBoolean();

// Clothing recommendations based on temperature
if (temperature < 5) {
System.out.println("It's very cold! Wear a heavy coat, gloves, and a hat.");
} else if (temperature < 15) {
System.out.println("It's cold! Wear a coat and a scarf.");
} else if (temperature < 25) {
System.out.println("It's moderate. Wear a light jacket or a sweater.");
} else {
System.out.println("It's warm! Wear a t-shirt and shorts.");
}

// Clothing recommendations based on wind speed
if (windSpeed > 20) {
System.out.println("It's windy! Wear a windbreaker or a heavier jacket.");
} else {
System.out.println("It's not very windy. You don't need any additional clothing for wind.");
}

// Clothing recommendations based on precipitation
if (isRaining) {
System.out.println("It's raining! Wear a waterproof jacket or bring an umbrella.");
} else {
System.out.println("It's not raining. You don't need any additional clothing for rain.");
}
}
}
```

In this program, the user is prompted to enter the current temperature, wind speed, and whether it's raining or not. Based on these inputs, the program uses if/else statements to determine appropriate clothing recommendations for the current weather conditions.

Note: This is a basic example and does not take into account all possible weather conditions or clothing options. You can modify and enhance the program as per your requirements.