import 'dart:io'; void main() { List> incomeList = []; List> expenseList = []; double totalIncome = 0.0; double totalExpenses = 0.0; print('Welcome to the Budget Management Application!'); print('Please choose an option:'); print('1. Add income'); print('2. Add expense'); print('3. View summary'); print('4. Exit'); while (true) { int choice = int.parse(stdin.readLineSync()!); if (choice == 1) { print('Enter income description:'); String description = stdin.readLineSync()!; print('Enter income amount:'); double amount = double.parse(stdin.readLineSync()!); if (amount < 0) { print('Amount cannot be negative. Please try again.'); continue; } incomeList.add({description: amount}); print('Income added successfully.'); } else if (choice == 2) { print('Enter expense description:'); String description = stdin.readLineSync()!; print('Enter expense amount:'); double amount = double.parse(stdin.readLineSync()!); if (amount < 0) { print('Amount cannot be negative. Please try again.'); continue; } expenseList.add({description: amount}); print('Expense added successfully.'); } else if (choice == 3) { incomeList.forEach((income) { totalIncome += income.values.first; }); expenseList.forEach((expense) { totalExpenses += expense.values.first; }); double netProfit = totalIncome - totalExpenses; print('Summary:'); print('Total income: \$$totalIncome'); print('Total expenses: \$$totalExpenses'); if (netProfit >= 0) { print('Your Net profit is: \$$netProfit'); double tax = netProfit * 0.15; print('Tax to be paid: \$$tax'); } else { print('Your Net loss is: \$$netProfit'); } } else if (choice == 4) { print('Exiting the application. Goodbye!'); break; } else { print('Invalid choice. Please try again.'); } } }