import 'dart:io'; void main() { print("Welcome to The Smart Home System !"); bool lightsOn = false; const minThermostat = 15; const maxThermostat = 30; int temperature = 20; bool securityArmed = false; while (true) { print("Please choose an action:"); print("1. Toggle lights"); print("2. Set thrmostat temperature"); print("3. Arm/disarm security system"); print("4. View system status "); print("Exit"); String? choice = stdin.readLineSync(); if (choice == "1") { // Toggle lights switch (lightsOn) { case true: lightsOn = false; print("Lights turned OFF "); break; case false: lightsOn = true; print(" Lights turned On"); break; } } else if (choice == "2") { // Set thrmostat temperature print("Enter Temperature ($minThermostat - $maxThermostat) :"); String? tempInput = stdin.readLineSync(); int? newtemp = int.tryParse(tempInput ?? ""); if (newtemp == null) { print("Invalid number"); } else if (newtemp < minThermostat || newtemp > maxThermostat) { print("Temperature out of rang !"); } else { temperature = newtemp; print("Temperature set to $temperature C"); } } else if (choice == "3") { // Arm/disarm security system switch (securityArmed) { case true: securityArmed = false; print("Security system Disarmed ."); break; case false: securityArmed = true; print("Security system Armed"); break; } } else if (choice == "4") { //View system status String lightsSatatus = lightsOn ? "ON" : "OFF"; String securityStatus = securityArmed ? "ARMED" : "DISARMED"; print(" System Status:"); print("Lights: $lightsSatatus"); print("Thermostat : $temperature"); print("Security System: ${securityStatus.toUpperCase()}"); // Fizz- like Logic if (temperature % 3 == 0 && temperature % 5 == 0) { print("Perfect Day."); } else if (temperature % 3 == 0) { print("Cool Day"); } else if (temperature % 5 == 0) { print("Warm Day."); } } else if (choice == "5") { print("Exiting system Goodbye !"); break; } else { print("Invalid choice. Please try again ."); } } }