import 'dart:io'; void main() { String light = "OFF"; int thermostat = 20; String securitySystem = "disarmed"; print("Weicome to the Ssmart System!"); print("Please choose an action:"); print("1. Toggle Lights"); print("2. Set thermostat temperature"); print("3. Arm/disarm security system\n4. View system state \n5. Exit"); while (true) { stdout.write("Enter your choice:"); int choice = int.parse(stdin.readLineSync()!); if (choice == 1) { switch (light) { case "ON": light = "OFF"; case "OFF": light = "ON"; } light = "ON"; print("Lights are now $light."); } else if (choice == 2) { const max = 30; const min = 15; print("Set thermostate temperature (15C - 30C):"); thermostat = int.parse(stdin.readLineSync()!); if (thermostat < max && thermostat > min) { print("Thermostate set to $thermostat C."); } else { print("Wrong temp"); print("Set thermostate temperature (15C - 30C):"); thermostat = int.parse(stdin.readLineSync()!); } } else if (choice == 3) { switch (securitySystem) { case "disarmed": securitySystem = "arm"; break; case "arm": securitySystem = "disarmed"; break; } print("Secutiry Status: $securitySystem"); } else if (choice == 4) { print("System Status:"); print("Light: $light"); String temp = ""; if (thermostat % 3 == 0 && thermostat % 5 == 0) { temp = "Perfect Day"; } else if (thermostat % 3 == 0) { temp = "Cool Day"; } else if (thermostat % 5 == 0) { temp = "Warm Day"; } print("Thermostat: $thermostat C - $temp"); String status = securitySystem.toUpperCase(); print("Security System: $status"); } else if (choice == 5) { print("Existing the system. Goodbye!"); break; } else { print('Invalid choice. Enter a number between 1 and 4.'); } } }