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