import 'dart:io'; void main() { bool lightsOn = false; int temperature = 20; bool securityArmed = false; const int minTemp = 15; const int maxTemp = 30; while (true) { print("\n=== Smart Home System ==="); print("1. Toggle Lights"); print("2. Set Temperature"); print("3. Toggle Security System"); print("4. Show Status"); print("5. 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 ($minTemp - $maxTemp): "); int? temp = int.tryParse(stdin.readLineSync() ?? ''); if (temp != null && temp >= minTemp && temp <= maxTemp) { temperature = temp; print("Temperature set to $temperature°C"); } else { print("Invalid temperature! Try again."); } } else if (choice == '3') { securityArmed = !securityArmed; print("Security system is now ${securityArmed ? 'ARMED' : 'DISARMED'}."); } else if (choice == '4') { print("\n--- System Status ---"); print("Lights: ${lightsOn ? 'ON' : 'OFF'}"); print("Temperature: $temperature°C"); print("Security: ${securityArmed ? 'ARMED' : 'DISARMED'}"); if (temperature % 3 == 0 && temperature % 5 == 0) { print("Perfect Day"); } else if (temperature % 3 == 0) { print("Cool Day"); } else if (temperature % 5 == 0) { print("Warm Day"); } } else if (choice == '5') { print("Goodbye!"); break; } else { print("Invalid option!"); } } }