import java.util.Scanner;

public class SmartHomeSystem {

    // Final/Const Variables
    final static int MIN_TEMP = 15;
    final static int MAX_TEMP = 30;

    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);

        boolean lightsOn = false;
        boolean securityArmed = false;
        int thermostat = 20; // درجة افتراضية

        int choice;

        do {
            System.out.println("\nWelcome to the Smart Home System!");
            System.out.println("Please choose an action:");
            System.out.println("1. Toggle lights");
            System.out.println("2. Set thermostat temperature");
            System.out.println("3. Arm/Disarm security system");
            System.out.println("4. View system status");
            System.out.println("5. Exit");
            System.out.print("Enter your choice: ");

            choice = input.nextInt();

            switch (choice) {

                case 1:
                    lightsOn = !lightsOn;
                    if (lightsOn) {
                        System.out.println("Lights are now ON.");
                    } else {
                        System.out.println("Lights are now OFF.");
                    }
                    break;

                case 2:
                    System.out.print("Set thermostat temperature (" 
                            + MIN_TEMP + "°C - " + MAX_TEMP + "°C): ");
                    int newTemp = input.nextInt();

                    // Logical & Relational Operators
                    if (newTemp >= MIN_TEMP && newTemp <= MAX_TEMP) {
                        thermostat = newTemp;
                        System.out.println("Thermostat set to " + thermostat + "°C.");
                    } else {
                        System.out.println("Invalid temperature! Must be between "
                                + MIN_TEMP + " and " + MAX_TEMP + ".");
                    }
                    break;

                case 3:
                    securityArmed = !securityArmed;
                    if (securityArmed) {
                        System.out.println("Security System ARMED.");
                    } else {
                        System.out.println("Security System DISARMED.");
                    }
                    break;

                case 4:
                    System.out.println("\nSystem Status:");
                    System.out.println("- Lights: " + (lightsOn ? "ON" : "OFF"));

                    String weather;
                    if (thermostat < 20) {
                        weather = "Cool Day";
                    } else if (thermostat <= 25) {
                        weather = "Warm Day";
                    } else {
                        weather = "Hot Day";
                    }

                    System.out.println("- Thermostat: " + thermostat + "°C - " + weather);
                    System.out.println("- Security System: " 
                            + (securityArmed ? "ARMED" : "DISARMED"));
                    break;

                case 5:
                    System.out.println("Exiting the system. Goodbye!");
                    break;

                default:
                    System.out.println("Invalid choice. Please try again.");
            }

        } while (choice != 5);
