import 'dart:io'; void main() { List> incomeList = []; List> expenseList = []; while (true) { print("\nBudget Management"); print("1. Add Income"); print("2. Add Expense"); print("3. View Summary"); print("4. Exit"); stdout.write("Choose option: "); int choice = int.parse(stdin.readLineSync()!); if (choice == 1) { stdout.write("Income description: "); String desc = stdin.readLineSync()!; stdout.write("Amount: "); double amount = double.parse(stdin.readLineSync()!); if (amount > 0) { incomeList.add({desc: amount}); } else { print("Invalid amount!"); } } else if (choice == 2) { stdout.write("Expense description: "); String desc = stdin.readLineSync()!; stdout.write("Amount: "); double amount = double.parse(stdin.readLineSync()!); if (amount > 0) { expenseList.add({desc: amount}); } else { print("Invalid amount!"); } } else if (choice == 3) { double totalIncome = 0; double totalExpense = 0; for (var item in incomeList) { totalIncome += item.values.first; } for (var item in expenseList) { totalExpense += item.values.first; } double net = totalIncome - totalExpense; print("\nTotal Income: $totalIncome"); print("Total Expenses: $totalExpense"); if (net > 0) { double tax = net * 0.15; print("Net Profit: $net"); print("Tax (15%): $tax"); } else { print("Net Loss: ${net.abs()}"); } } else if (choice == 4) { print("Goodbye!"); break; } } }