import 'dart:io'; void main(){ print('Welcome to the Smart Home System!'); bool lights = false; int thermostat = 20; bool securitySystem = false; bool systemOn= true; 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"); while (systemOn) { stdout.write("\nEnter your choice: "); String? choice = stdin.readLineSync(); switch (choice) { case "1": lights = !lights; print("Lights are now ${lights ? 'ON' : 'OFF'}."); break; case "2": stdout.write("Set thermostat temperature (15°C - 30°C):"); String? inputTemp = stdin.readLineSync(); int? temp = int.tryParse(inputTemp ?? ""); if (temp != null && temp >= 15 && temp <=30){ thermostat = temp; print("Thermostat set to $thermostat°C."); }else { print("Invalid temperature! Please enter a value between 15 and 30."); } break; case "3": securitySystem = !securitySystem; print("Security System is now ${securitySystem ? 'ARMED' : 'DISARMED'}"); break; case "4": print("System Status:"); print("Lights : ${lights ? 'ON' : 'OFF'}"); String tempStatus = ""; if (thermostat % 3 == 0 ) { tempStatus = "Cool Day"; }else if (thermostat % 5 == 0 ) { tempStatus = "Warm Day"; }else if (thermostat % 3 == 0 && thermostat % 5 == 0){ tempStatus = "Perfect Day"; } print("Thermostat : $thermostat°C - ${tempStatus}"); print("Security System : ${securitySystem ? 'ARMED' : 'DISARMED'}"); break; case "5": print("Exiting the system. Goodbye!"); systemOn = false; break; default : print ("Invalid choice, please try again."); } } }