Karema Ghaleb-251000800- Question 1 // Exam 3 - Question 1 // Student Name: Karema Ghaleb // University ID: 251000800 import 'dart:io'; void main() { // حالة الأجهزة bool lightsOn = false; int temperature = 20; bool securityArmed = false; // نطاق الحرارة المسموح const int minTemp = 15; const int maxTemp = 30; bool running = true; print("Welcome to Smart Home Automation System"); while (running) { print("\n--- Main Menu ---"); print("1. Control Devices"); print("2. View System Status"); print("3. Exit"); String? choice = stdin.readLineSync(); if (choice == '1') { print("\nSelect Device:"); print("1. Lights"); print("2. Thermostat"); print("3. Security System"); String? deviceChoice = stdin.readLineSync(); switch (deviceChoice) { case '1': lightsOn = !lightsOn; print("Lights are now ${lightsOn ? 'ON' : 'OFF'}"); break; case '2': print("Enter temperature ($minTemp - $maxTemp):"); String? tempInput = stdin.readLineSync(); int? newTemp = int.tryParse(tempInput ?? ""); 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; default: print("Invalid device choice."); } } else if (choice == '2') { print("\n--- System Status ---"); print("Lights: ${lightsOn ? 'ON' : 'OFF'}"); print("Security System: ${securityArmed ? 'ARMED' : 'DISARMED'}"); if (temperature % 3 == 0 && temperature % 5 == 0) { print("Thermostat: $temperature °C - Perfect Day"); } else if (temperature % 3 == 0) { print("Thermostat: $temperature °C - Cool Day"); } else if (temperature % 5 == 0) { print("Thermostat: $temperature °C - Warm Day"); } else { print("Thermostat: $temperature °C"); } } else if (choice == '3') { running = false; print("Exiting the system. Goodbye!"); } else { print("Invalid option, please try again."); } } }