SMART HOME AUTOMATION SYSTEM - QUESTION 1 import 'dart:io'; const int MIN_TEMP = 15; const int MAX_TEMP = 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 choice (1-5): '); String? input = stdin.readLineSync(); int? choice = int.tryParse(input ?? ''); if (choice == null) { print('Invalid input. Please try again.'); continue; } switch (choice) { case 1: lightsOn = !lightsOn; print('Lights turned ${lightsOn ? 'ON' : 'OFF'}.'); break; case 2: stdout.write('Enter temperature ($MIN_TEMP°C - $MAX_TEMP°C): '); int? newTemp = int.tryParse(stdin.readLineSync() ?? ''); if (newTemp == null || newTemp < MIN_TEMP || newTemp > MAX_TEMP) { print('Invalid temperature. Must be within range.'); } else { thermostat = newTemp; print('Thermostat set to ${thermostat}°C.'); } break; case 3: securityArmed = !securityArmed; print('Security system is now ${securityArmed ? 'ARMED' : 'DISARMED'}.'); break; case 4: _printSystemStatus(lightsOn, thermostat, securityArmed); break; case 5: print('Exiting program. Goodbye!'); return; default: print('Invalid choice.'); } } } void _printSystemStatus(bool lightsOn, int thermostat, bool securityArmed) { String securityStatus = securityArmed ? 'ARMED' : 'DISARMED'; String lightsStatus = lightsOn ? 'ON' : 'OFF'; print('\n----- System Status -----'); print('Lights: $lightsStatus'); print('Thermostat: ${thermostat}°C'); print('Security: $securityStatus'); bool multipleOf3 = thermostat % 3 == 0; bool multipleOf5 = thermostat % 5 == 0; if (multipleOf3 && multipleOf5) { print('Temperature note: Perfect Day.'); } else if (multipleOf3) { print('Temperature note: Cool Day.'); } else if (multipleOf5) { print('Temperature note: Warm Day.'); } else { print('Temperature note: Normal Day.'); } print('-------------------------\n'); }