import 'dart:io'; void main() { double totalIncome = 0; double totalExpenses = 0; const double taxRate = 0.15; print('Welcome to the Budget Management Application!'); while (true) { print('\nPlease choose an option:'); print('1. Add income'); print('2. Add expense'); print('3. View summary'); print('4. Exit'); stdout.write('Enter your choice: '); String? choice = stdin.readLineSync(); switch (choice) { case '1': stdout.write('Enter income description: '); stdin.readLineSync(); stdout.write('Enter income amount: '); double income = double.parse(stdin.readLineSync()!); totalIncome += income; print('Income added!'); break; case '2': stdout.write('Enter expense description: '); stdin.readLineSync(); stdout.write('Enter expense amount: '); double expense = double.parse(stdin.readLineSync()!); totalExpenses += expense; print('Expense added!'); break; case '3': double netProfit = totalIncome - totalExpenses; double tax = netProfit > 0 ? netProfit * taxRate : 0; print('\nSummary:'); print('Total income: \$${totalIncome.toStringAsFixed(0)}'); print('Total expenses: \$${totalExpenses.toStringAsFixed(0)}'); print('Net profit: \$${netProfit.toStringAsFixed(0)}'); print('Tax to be paid: \$${tax.toStringAsFixed(0)}'); break; case '4': print('Exiting the application. Goodbye!'); return; default: print('Invalid choice. Please try again.'); } } }