import 'dart:io'; void main() { // ????? ??????? ?????? ?????????? bool isLightsOn = false; // LightsOff double temperature = 20.0; // 20°C for thermostat String securityStatus = "disarmed"; // disarmed print("--- Welcome to Smart Home System ---"); // ???? ????? ?????? ???????? ??????? bool running = true; while (running) { print("\nSelect an option:"); print("1. Toggle Lights (On/Off)"); print("2. Set Thermostat Temperature"); print("3. Arm/Disarm Security System"); print("4. View System Status"); print("5. Exit"); stdout.write("Choice: "); String? choice = stdin.readLineSync(); // ??????? switch ?????? ?? ??????? switch (choice) { case '1': isLightsOn = !isLightsOn; print("Lights are now ${isLightsOn ? 'ON' : 'OFF'}."); break; case '2': stdout.write("Enter temperature (15-30): "); double? inputTemp = double.tryParse(stdin.readLineSync()!); // ?????? ?? ??? ???????? (Input Validation) if (inputTemp != null && inputTemp >= 15 && inputTemp <= 30) { temperature = inputTemp; print("Temperature set to $temperature°C."); } else { print("Invalid input! Please enter a value between 15 and 30."); } break; case '3': securityStatus = (securityStatus == "disarmed") ? "armed" : "disarmed"; print("Security System is now ${securityStatus.toUpperCase()}."); // ????? ???? ????? ????? break; case '4': // ??? ???? ?????? ???????? String Interpolation print("\n--- Current Status ---"); print("Lights: ${isLightsOn ? 'ON' : 'OFF'}"); print("Security: ${securityStatus.toUpperCase()}"); // ???? FizzBuzz ??????? String weatherMsg = ""; int tempInt = temperature.round(); if (tempInt % 3 == 0 && tempInt % 5 == 0) { weatherMsg = "Perfect Day"; } else if (tempInt % 3 == 0) { weatherMsg = "Cool Day"; } else if (tempInt % 5 == 0) { weatherMsg = "Warm Day"; } print("Temperature: $temperature°C ${weatherMsg.isNotEmpty ? '- $weatherMsg' : ''}"); break; case '5': running = false; print("Exiting system... Goodbye!"); break; default: print("Invalid choice, try again."); } } }