import 'dart:io'; void main() { bool lightsOn = false; int temperature = 22; // Default temperature while (true) { print("\nSmart Home System"); print("1. Turn Lights ON/OFF"); print("2. Set Temperature"); print("3. Show Status"); print("4. Exit"); stdout.write("Enter your choice: "); String? choice = stdin.readLineSync(); if (choice == '1') { lightsOn = !lightsOn; print("Lights are now ${lightsOn ? 'ON' : 'OFF'}"); } else if (choice == '2') { stdout.write("Enter temperature (15-30): "); int? temp = int.tryParse(stdin.readLineSync()!); if (temp != null && temp >= 15 && temp <= 30) { temperature = temp; print("Temperature set to $temperature°C"); } else { print("Invalid temperature! Enter a number between 15 and 30."); } } else if (choice == '3') { print("\nHome Status:"); print("Lights: ${lightsOn ? 'ON' : 'OFF'}"); print("Temperature: $temperature°C"); } else if (choice == '4') { print("Exiting..."); break; } else { print("Invalid choice, try again."); } } }