import 'dart:io'; void main() { const int minTemp = 15; const int maxTemp = 30; bool lightsOn = false; int thermostat = 20; String security = "disarmed"; while (true) { print("\nSmart Home System"); print("1. Toggle Lights"); print("2. Set Thermostat"); print("3. Toggle Security System"); print("4. View Status"); print("5. Exit"); stdout.write("Choose option: "); int choice = int.parse(stdin.readLineSync()!); switch (choice) { case 1: lightsOn = !lightsOn; print("Lights are now ${lightsOn ? "ON" : "OFF"}"); break; case 2: stdout.write("Enter temperature (15 - 30): "); int temp = int.parse(stdin.readLineSync()!); if (temp >= minTemp && temp <= maxTemp) { thermostat = temp; print("Temperature set to $thermostat°C"); } else { print("Invalid temperature!"); } break; case 3: security = security == "armed" ? "disarmed" : "armed"; print("Security System: ${security.toUpperCase()}"); break; case 4: String dayType = ""; if (thermostat % 3 == 0 && thermostat % 5 == 0) { dayType = "Perfect Day"; } else if (thermostat % 3 == 0) { dayType = "Cool Day"; } else if (thermostat % 5 == 0) { dayType = "Warm Day"; } print("\nSystem Status:"); print("Lights: ${lightsOn ? "ON" : "OFF"}"); print("Thermostat: $thermostat°C $dayType"); print("Security: ${security.toUpperCase()}"); break; case 5: print("Exiting program..."); return; default: print("Invalid choice"); } } }