import 'dart:io'; const int minTemp = 15; const int maxTemp = 30; void main() { bool lightsOn = false; int thermostat = 20; bool securityArmed = false; print("Welcome to the Smart Home System!"); while (true) { print("\nPlease choose an action:"); 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: "); String? choice = stdin.readLineSync(); if (choice == '1') { lightsOn = !lightsOn; print("Lights are now ${lightsOn ? 'ON' : 'OFF'}."); } else if (choice == '2') { stdout.write("Set thermostat temperature ($minTemp℃ - $maxTemp℃): "); int? temp = int.tryParse(stdin.readLineSync() ?? ''); if (temp != null && temp >= minTemp && temp <= maxTemp) { thermostat = temp; print("Thermostat set to $thermostat℃."); } else { print("Invalid temperature. Please enter a value between $minTemp and $maxTemp."); } } else if (choice == '3') { securityArmed = !securityArmed; print("Security System is now ${securityArmed ? 'ARMED' : 'DISARMED'}."); } else if (choice == '4') { print("\nSystem Status:"); print("- Lights: ${lightsOn ? 'ON' : 'OFF'}"); 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("- Thermostat: $thermostat℃$dayType"); print("- Security System: ${securityArmed ? 'ARMED' : 'DISARMED'}"); } else if (choice == '5') { print("Exiting the system. Goodbye!"); break; } else { print("Invalid choice. Please try again."); } } }