Smart Home Automation System - Dart Solution ---------------------------------------------- import 'dart:io'; const int minTemp = 15; const int maxTemp = 30; void main() { bool lightsOn = false; int thermostat = 20; bool securityArmed = false; while (true) { print("\n=== Smart Home Automation ==="); print("1. Toggle Lights"); print("2. Set Thermostat"); print("3. Arm/Disarm Security System"); print("4. View System Status"); print("5. Exit"); stdout.write("Choose an option: "); String? choice = stdin.readLineSync(); if (choice == "1") { lightsOn = !lightsOn; print("Lights are now: ${lightsOn ? "ON" : "OFF"}"); } else if (choice == "2") { stdout.write("Enter temperature ($minTemp-$maxTemp): "); String? tempInput = stdin.readLineSync(); int? temp = int.tryParse(tempInput ?? ""); if (temp != null && temp >= minTemp && temp <= maxTemp) { thermostat = temp; print("Thermostat set to $thermostat°C"); } else { print("Invalid temperature."); } } else if (choice == "3") { securityArmed = !securityArmed; print("Security system is now: ${securityArmed ? "ARMED" : "DISARMED"}"); } else if (choice == "4") { String lightStatus = lightsOn ? "ON" : "OFF"; String securityStatus = securityArmed ? "ARMED".toUpperCase() : "DISARMED".toUpperCase(); String tempMessage = ""; if (thermostat % 3 == 0 && thermostat % 5 == 0) { tempMessage = "Perfect Day"; } else if (thermostat % 3 == 0) { tempMessage = "Cool Day"; } else if (thermostat % 5 == 0) { tempMessage = "Warm Day"; } print("\n--- System Status ---"); print("Lights: $lightStatus"); print("Thermostat: $thermostat°C $tempMessage"); print("Security System: $securityStatus"); } else if (choice == "5") { print("Exiting system..."); break; } else { print("Invalid choice."); } } } ------------------------------------------------------- Budget Management System - Dart Solution ------------------------------------------------------- import 'dart:io'; void main() { List> incomeList = []; List> expenseList = []; while (true) { print("\n=== Budget Management ==="); print("1. Add Income"); print("2. Add Expense"); print("3. View Summary"); print("4. Exit"); stdout.write("Choose an option: "); String? choice = stdin.readLineSync(); if (choice == "1") { stdout.write("Income description: "); String desc = stdin.readLineSync() ?? ""; stdout.write("Amount: "); double? amount = double.tryParse(stdin.readLineSync() ?? ""); if (amount != null && amount >= 0) { incomeList.add({desc: amount}); print("Income added."); } else { print("Invalid amount."); } } else if (choice == "2") { stdout.write("Expense description: "); String desc = stdin.readLineSync() ?? ""; stdout.write("Amount: "); double? amount = double.tryParse(stdin.readLineSync() ?? ""); if (amount != null && amount >= 0) { expenseList.add({desc: amount}); print("Expense added."); } else { print("Invalid amount."); } } else if (choice == "3") { double incomeTotal = 0; double expenseTotal = 0; incomeList.forEach((item) => incomeTotal += item.values.first); expenseList.forEach((item) => expenseTotal += item.values.first); double net = incomeTotal - expenseTotal; print("\n--- Summary ---"); print("Total Income: \$${incomeTotal}"); print("Total Expenses: \$${expenseTotal}"); print(net >= 0 ? "Your net profit is \$${net}" : "Your net loss is \$${net.abs()}"); double tax = net > 0 ? net * 0.15 : 0; if (tax > 0) { print("Tax to be paid: \$${tax}"); } } else if (choice == "4") { print("Exiting..."); break; } else { print("Invalid choice."); } } }