import 'dart:io'; void main() { // Temps const int minTemp = 15; const int maxTemp = 30; // Devices initial value bool lightsOn = false; int thermostat = 20; bool securityArmed = false; while (true) { print("\n=== SMART HOME CONTROL PANEL ==="); print("1. Turn Lights On/Off"); print("2. Set Thermostat Temperature ($minTemp°C - $maxTemp°C)"); print("3. Arm/Disarm Security System"); print("4. View System Status"); print("5. Exit"); stdout.write("Enter your choice: "); String? choice = 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.tryParse(stdin.readLineSync()!); if (temp != null && temp >= minTemp && temp <= maxTemp) { thermostat = temp; print("Thermostat set to $thermostat°C"); } else { print("Invalid temperature! Please try again."); } break; case "3": securityArmed = !securityArmed; print("Security system is now: ${securityArmed ? "ARMED" : "DISARMED"}"); break; case "4": // Day type String weatherMsg = ""; if (thermostat % 3 == 0 && thermostat % 5 == 0) { weatherMsg = "Perfect Day"; } else if (thermostat % 3 == 0) { weatherMsg = "Cool Day"; } else if (thermostat % 5 == 0) { weatherMsg = "Warm Day"; } print("\n=== SYSTEM STATUS ==="); print("Lights: ${lightsOn ? "ON" : "OFF"}"); print("Thermostat: $thermostat°C ${weatherMsg.isNotEmpty ? "($weatherMsg)" : ""}"); print("Security: ${securityArmed ? "ARMED".toUpperCase() : "disarmed"}"); break; case "5": print("See you later!"); return; default: print("Invalid selection."); } } }