import 'dart:io'; void main() { // Initialize the system with default values bool lightsOn = false; int thermostat = 20; bool securityArmed = false; while (true) { // Display options menu to the user print('\nChoose an action:'); print('1. Turn lights on/off'); print('2. Set thermostat temperature'); print('3. Arm/disarm security system'); print('4. View system status'); print('5. Exit'); String? choice = stdin.readLineSync(); switch (choice) { case '1': lightsOn = !lightsOn; print(lightsOn ? 'Lights are now ON' : 'Lights are now OFF'); break; case '2': print('Enter a temperature between 15 and 30:'); int? temp = int.tryParse(stdin.readLineSync() ?? ''); if (temp != null && temp >= 15 && temp <= 30) { thermostat = temp; print('Thermostat set to $thermostat °C.'); } else { print('Invalid temperature.'); } break; case '3': securityArmed = !securityArmed; print(securityArmed ? 'Security system is ARMED' : 'Security system is DISARMED'); break; case '4': print('System Status:'); print('Lights: ${lightsOn ? "ON" : "OFF"}'); print('Thermostat: $thermostat °C (${thermostat % 3 == 0 ? "Cool Day" : thermostat % 5 == 0 ? "Warm Day" : "Moderate Day"})'); print('Security System: ${securityArmed ? "ARMED" : "DISARMED"}'); break; case '5': print('Goodbye!'); return; default: print('Invalid choice.'); } } }