TaghreedAdel_243000607_question1.txt /** * Student Name: تغريد عادل * University ID: 243000607 * Question: 1 - Smart Home Automation System */ import 'dart:io'; void main() { const int minTemp = 15; const int maxTemp = 30; bool isLightOn = false; int temperature = 20; bool isArmed = false; print('Welcome to the Smart Home System, Taghreed!'); 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') { isLightOn = !isLightOn; print('Lights are now ${isLightOn ? "ON" : "OFF"}.'); } else if (choice == '2') { stdout.write('Set thermostat temperature ($minTemp°C - $maxTemp°C): '); int? inputTemp = int.tryParse(stdin.readLineSync() ?? ''); if (inputTemp != null && inputTemp >= minTemp && inputTemp <= maxTemp) { temperature = inputTemp; print('Thermostat set to $temperature°C.'); } else { print('Invalid temperature! Please enter a value between $minTemp and $maxTemp.'); } } else if (choice == '3') { isArmed = !isArmed; String statusText = isArmed ? "armed" : "disarmed"; print('Security System is now ${statusText.toUpperCase()}.'); } else if (choice == '4') { print('\n--- System Status for Taghreed ---'); print('- Lights: ${isLightOn ? "ON" : "OFF"}'); String tempNote = ""; if (temperature % 3 == 0 && temperature % 5 == 0) { tempNote = " - Perfect Day"; } else if (temperature % 3 == 0) { tempNote = " - Cool Day"; } else if (temperature % 5 == 0) { tempNote = " - Warm Day"; } print('- Thermostat: $temperature°C$tempNote'); print('- Security System: ${isArmed ? "ARMED" : "DISARMED"}'); } else if (choice == '5') { print('Exiting the system. Goodbye, Taghreed!'); break; } else { print('Invalid choice, please try again.'); } } }