Smart Home Automation ---------------------------------------- import 'dart:io'; void main() { const int minTemp = 15; const int maxTemp = 30; bool lightsOn = false; int temperature = 20; bool securityArmed = false; while (true) { print('\n=== Smart Home Automation System ==='); print('1. Turn Lights On/Off'); print('2. Set Thermostat Temperature'); 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 == '5') { print('Exiting Smart Home System... Goodbye!'); break; } switch (choice) { case '1': lightsOn = !lightsOn; print('Lights turned ${lightsOn ? "ON" : "OFF"}'); break; case '2': stdout.write('Enter temperature ($minTemp - $maxTemp): '); int? newTemp = int.tryParse(stdin.readLineSync()!); if (newTemp != null && newTemp >= minTemp && newTemp <= maxTemp) { temperature = newTemp; print('Temperature set to $temperature°C'); } else { print('Invalid temperature! Must be between $minTemp and $maxTemp.'); } break; case '3': securityArmed = !securityArmed; print('Security system is now ${securityArmed ? "ARMED" : "DISARMED"}'); break; case '4': print('\n--- System Status ---'); print('Lights: ${lightsOn ? "ON" : "OFF"}'); print('Thermostat: $temperature°C'); 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'); } print('Security System: ${securityArmed ? "ARMED" : "DISARMED"}'); break; default: print('Invalid option. Please try again.'); } } } Budget Management Application ---------------------------------------- import 'dart:io'; void main() { List> incomeList = []; List> expenseList = []; while (true) { print('\n=== Budget Management Application ==='); 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 == '4') { print('Exiting Budget Manager... Goodbye!'); break; } switch (choice) { case '1': stdout.write('Enter income description: '); String? desc = stdin.readLineSync(); stdout.write('Enter income amount: '); double? amount = double.tryParse(stdin.readLineSync()!); if (amount != null && amount > 0) { incomeList.add({desc ?? 'Income': amount}); print('Income added successfully.'); } else { print('Invalid amount. Please enter a positive number.'); } break; case '2': stdout.write('Enter expense description: '); String? desc = stdin.readLineSync(); stdout.write('Enter expense amount: '); double? amount = double.tryParse(stdin.readLineSync()!); if (amount != null && amount > 0) { expenseList.add({desc ?? 'Expense': amount}); print('Expense added successfully.'); } else { print('Invalid amount. Please enter a positive number.'); } break; case '3': double totalIncome = 0; double totalExpense = 0; for (var i in incomeList) { totalIncome += i.values.first; } for (var e in expenseList) { totalExpense += e.values.first; } double net = totalIncome - totalExpense; print('\n--- Summary ---'); print('Total Income: \$${totalIncome.toStringAsFixed(2)}'); print('Total Expenses: \$${totalExpense.toStringAsFixed(2)}'); if (net > 0) { double tax = net * 0.15; print('Your net profit is \$${net.toStringAsFixed(2)}'); print('Tax to be paid (15%): \$${tax.toStringAsFixed(2)}'); } else if (net < 0) { print('Your net loss is \$${net.abs().toStringAsFixed(2)}'); } else { print('You broke even — no profit, no loss.'); } break; default: print('Invalid option. Please try again.'); } } }