Menu with user choices • Input handling for lights, thermostat, and security • FizzBuzz-style temperature messages (“Cool Day”, “Warm Day”, “Perfect Day”) • Proper use of constants, conditions, and string interpolation import 'dart:io'; void main() { // الثوابت الخاصة بدرجات الحرارة const int minTemp = 15; const int maxTemp = 30; // القيم الافتراضية للأجهزة bool lightsOn = false; int thermostat = 20; bool securityArmed = false; while (true) { print('\nWelcome to the Smart Home System!'); print('Please 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('\nEnter your choice: '); String? choice = stdin.readLineSync(); if (choice == null) continue; switch (choice) { case '1': // تشغيل أو إطفاء الأضواء lightsOn = !lightsOn; print('Lights are now ${lightsOn ? 'ON' : 'OFF'}.'); break; case '2': // ضبط درجة الحرارة stdout.write('Set thermostat temperature ($minTemp°C - $maxTemp°C): '); String? tempInput = stdin.readLineSync(); int? temp = int.tryParse(tempInput ?? ''); if (temp == null || temp < minTemp || temp > maxTemp) { print('Invalid temperature! Please enter a value between $minTemp and $maxTemp.'); } else { thermostat = temp; print('Thermostat set to ${thermostat}°C.'); } break; case '3': // تفعيل أو إلغاء النظام الأمني securityArmed = !securityArmed; print('Security system is now ${securityArmed ? 'ARMED' : 'DISARMED'}.'); break; case '4': // عرض حالة النظام print('\nSystem Status:'); print('- Lights: ${lightsOn ? 'ON' : 'OFF'}'); print('- Thermostat: ${thermostat}°C ${getTempStatus(thermostat)}'); print('- Security System: ${securityArmed ? 'ARMED' : 'DISARMED'}'); break; case '5': print('Exiting the system, Goodbye!'); return; default: print('Invalid choice! Please try again.'); } } } // دالة لتحديد حالة درجة الحرارة (FizzBuzz logic) String getTempStatus(int temp) { if (temp % 3 == 0 && temp % 5 == 0) { return '- Perfect Day'; } else if (temp % 3 == 0) { return '- Cool Day'; } else if (temp % 5 == 0) { return '- Warm Day'; } else { return ''; } }