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("\nWelcome to the Smart Home System!"); print("1 Toggle lights"); print("2 Set thermostat temperature"); print("3 Arm/Disarm security system"); print("4 View system status"); print("5 Exit"); stdout.write("Enter your choice: "); 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 ($minTemp - $maxTemp): "); int temp = int.parse(stdin.readLineSync()!); if (temp >= minTemp && temp <= maxTemp) { thermostat = temp; print("Thermostat set to $thermostat °C"); } else { print("Invalid temperature!"); } break; case 3: securityArmed = !securityArmed; print("Security system ${securityArmed ? "ARMED" : "DISARMED"}"); 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: ${(securityArmed ? "armed" : "disarmed").toUpperCase()}"); break; case 5: print("Goodbye!"); return; default: print("Invalid choice"); } } }