import 'dart:io'; const int minTemp = 15; const int maxTemp = 30; void main() { bool lightsOn = false; int thermostat = 20; bool securityArmed = false; while (true) { print('\n=== Smart Home Menu ==='); 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 == '5') { print('Exiting Smart Home System. Goodbye!'); break; } switch (choice) { case '1': lightsOn = !lightsOn; print('Lights turned ${lightsOn ? "ON" : "OFF"}'); break; case '2': stdout.write('Enter temperature ($minTemp-$maxTemp): '); String? input = stdin.readLineSync(); int? temp = int.tryParse(input!); if (temp != null && temp >= minTemp && temp <= maxTemp) { thermostat = temp; print('Thermostat set to $thermostat°C'); } else { print('Invalid temperature! Must be between $minTemp and $maxTemp.'); } break; case '3': securityArmed = !securityArmed; print('Security System is now ${securityArmed ? "ARMED" : "DISARMED"}'); break; case '4': print('\n--- System Status ---'); String lightsStatus = lightsOn ? "ON" : "OFF"; String securityStatus = securityArmed ? "ARMED" : "DISARMED"; print('Lights: $lightsStatus'); print('Thermostat: $thermostat°C'); print('Security System: ${securityStatus.toUpperCase()}'); if (thermostat % 3 == 0 && thermostat % 5 == 0) { print('Perfect Day'); } else if (thermostat % 3 == 0) { print('Cool Day'); } else if (thermostat % 5 == 0) { print('Warm Day'); } break; default: print('Invalid choice. Please try again.'); } } }