=== question1.dart === import 'dart:io'; void main() { bool lightsOn = false; int temperature = 20; bool securityArmed = false; const int minTemp = 15; const int maxTemp = 30; while (true) { print('\n--- Smart Home Menu ---'); print('1. Toggle Lights'); print('2. Set Temperature'); print('3. Toggle Security System'); print('4. View Status'); print('5. Exit'); stdout.write('Enter your choice: '); String? choice = stdin.readLineSync(); switch (choice) { case '1': lightsOn = !lightsOn; print('Lights are now ${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('Temperature: $temperature°C'); print('Security: ${securityArmed ? "ARMED" : "DISARMED"}'); 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'); } break; case '5': print('Exiting Smart Home System...'); return; default: print('Invalid choice. Try again.'); } } } === question2.dart === import 'dart:io'; void main() { List> incomeList = []; List> expenseList = []; print('Welcome to the Budget Management Application!'); while (true) { print('\n--- Menu ---'); print('1. Add Income'); print('2. Add Expense'); print('3. View Summary'); print('4. Exit'); stdout.write('Enter your choice: '); String? choice = stdin.readLineSync(); if (choice == '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 ?? 'Unknown': amount}); print('Income added.'); } else { print('Invalid amount.'); } } else if (choice == '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 ?? 'Unknown': amount}); print('Expense added.'); } else { print('Invalid amount.'); } } else if (choice == '3') { double totalIncome = incomeList.fold(0, (sum, item) => sum + item.values.first); double totalExpense = expenseList.fold(0, (sum, item) => sum + item.values.first); double netProfit = totalIncome - totalExpense; double tax = netProfit > 0 ? netProfit * 0.15 : 0; print('\n--- Summary ---'); print('Total Income: \$${totalIncome.toStringAsFixed(2)}'); print('Total Expenses: \$${totalExpense.toStringAsFixed(2)}'); if (netProfit > 0) { print('Your net profit is \$${netProfit.toStringAsFixed(2)}'); print('Tax (15%): \$${tax.toStringAsFixed(2)}'); } else if (netProfit < 0) { print('Your net loss is \$${(-netProfit).toStringAsFixed(2)}'); } else { print('You broke even.'); } } else if (choice == '4') { print('Exiting Budget Management Application...'); break; } else { print('Invalid choice. Try again.'); } } }