Assignment 2: Budget import 'dart:io'; void main() { List> incomeList = []; List> expenseList = []; while (true) { print('\n--- Budget Manager ---'); 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('Description: '); String? desc = stdin.readLineSync()?.trim(); if (desc == null || desc.isEmpty) { print('Description cannot be empty.'); continue; } stdout.write('Amount: '); double? amount = double.tryParse(stdin.readLineSync() ?? ''); if (amount == null || amount <= 0) { print('Amount must be a positive number.'); continue; } incomeList.add({desc: amount}); print('Added income: $desc - \$${amount.toStringAsFixed(2)}'); } else if (choice == '2') { stdout.write('Description: '); String? desc = stdin.readLineSync()?.trim(); if (desc == null || desc.isEmpty) { print('Description cannot be empty.'); continue; } stdout.write('Amount: '); double? amount = double.tryParse(stdin.readLineSync() ?? ''); if (amount == null || amount <= 0) { print('Amount must be a positive number.'); continue; } expenseList.add({desc: amount}); print('Added expense: $desc - \$${amount.toStringAsFixed(2)}'); } else if (choice == '3') { double totalIncome = 0; for (var item in incomeList) { } totalIncome += item.values.first; double totalExpense = 0; for (var item in expenseList) { totalExpense += item.values.first; } double net = totalIncome - totalExpense; if (net >= 0) { print('Your net profit is \$${net.toStringAsFixed(2)}'); double tax = net > 0 ? net * 0.15 : 0.0; if (tax > 0) { print('Tax to pay (15%): \$${tax.toStringAsFixed(2)}'); } } else { print('Your net loss is \$${(-net).toStringAsFixed(2)}'); } print('\nIncome:'); if (incomeList.isEmpty) print(' None'); else for (var inc in incomeList) inc.forEach((d, a) => print(' $d: \$${a.toStringAsFixed(2)}')); print('\nExpenses:'); if (expenseList.isEmpty) print(' None'); else for (var exp in expenseList) exp.forEach((d, a) => print(' $d: \$${a.toStringAsFixed(2)}')); } else if (choice == '4') { print('Goodbye!'); break; } else { print('Invalid choice. Try again.'); } } }