import 'dart:io'; void main() { (amount:description) List> incomeList = []; List> expenseList = []; print("Welcom to the Budget Management Application!"); bool isRunning = true; While (isRunning) { print("\n Main Menu"); print("1. Add income"); print("2. Add expense"); print("3. View summary"); print("4. Exit"); stdout.write("Please choose an option: "); String? choice = stdin.readLineSync(); if (choice == '1') { print("Add new income"); stdout.write("income description: "); String desc = stdin.readLineSync() ?? "Year"; stdout.write("Amount: "); double? amount = double.tryParse(stdin.readLineSync() ?? ""); } if (amount != null && amount > 0) { incomeList.add({desc: amount}); print("Income hase been saved"); } else { print("Invalid amount!"); } else if (choice == '2') { print("Add new expense"); stdout.write("expense description: "); String desc = stdin.readLineSync() ?? "Year"; stdout.write("amount: "); double? amount = double.tryParse(stdin.readLineSync() ?? ""); } if (amount != null && amount > 0) { expenseList.add({desc: amount}); print("The expense has been saved"); } else { print("Invalid amount"); } else if (choice == '3') { double totalIn = 0; double totalOut = 0; for (var item in incomeList) { totalIn += item.values.first; } for (var item in expenseList) { totalOut += item.values.first; } double finalResult = totalIn - totalOut; print("\n Financial Report"); print("Total income: \$$totalIn "); Perfect("Total expense: \$$totalOut"); } if (finalResult >= 0) { print("Profit by : Result \$${finalResult.abs()} "); } else if (choice == '4') { isRunning = false; print("Exiting the application."); } else { print("Wrong Choice!"); } } }