import 'dart:io'; void main() { const int minTemp = 15; const int maxTemp = 30; bool lightsOn = false; int temperature = 20; bool securityArmed = false; while (true) { print('\n=== Smart Home Automation System ==='); 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'); 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 new temperature ($minTemp-$maxTemp °C): '); int? newTemp = int.tryParse(stdin.readLineSync() ?? ''); if (newTemp != null && newTemp >= minTemp && newTemp <= maxTemp) { temperature = newTemp; print('Temperature set to $temperature °C.'); } else { print('Invalid temperature! Please enter a value between $minTemp and $maxTemp.'); } break; case '3': securityArmed = !securityArmed; print('Security system is now ${securityArmed ? "ARMED" : "DISARMED"}.'); break; case '4': String status = ''' Lights: ${lightsOn ? "ON" : "OFF"} Thermostat: $temperature °C Security System: ${securityArmed ? "ARMED" : "DISARMED"} '''; if (temperature % 3 == 0 && temperature % 5 == 0) { status += '→ Perfect Day!\n'; } else if (temperature % 3 == 0) { status += '→ Cool Day!\n'; } else if (temperature % 5 == 0) { status += '→ Warm Day!\n'; } print('\n--- System Status ---'); print(status); break; default: print('Invalid choice! Please select a valid option.'); } } }