import 'dart:io'; void main() { // القوائم لتخزين البيانات List> incomes = []; List> expenses = []; print("Welcome to Budget Manager!"); while (true) { // print("\n1. Add Income"); print("2. Add Expense"); print("3. View Summary"); print("4. Exit"); stdout.write("Select: "); String? choice = stdin.readLineSync(); if (choice == "1") { stdout.write("Income Description: "); String name = stdin.readLineSync()!; stdout.write("Amount: "); double money = double.parse(stdin.readLineSync()!); if (money > 0) { incomes.add({name: money}); // إضافة للقائمة print("Income Added!"); } } else if (choice == "2") { stdout.write("Expense Description: "); String name = stdin.readLineSync()!; stdout.write("Amount: "); double money = double.parse(stdin.readLineSync()!); if (money > 0) { expenses.add({name: money}); print("Expense Added!"); } } else if (choice == "3") { double totalIn = 0; double totalEx = 0; // حساب المجموع for (var i in incomes) { totalIn = totalIn + i.values.first; } for (var e in expenses) { totalEx = totalEx + e.values.first; } double net = totalIn - totalEx; print("--- Summary ---"); print("Total Income: \$$totalIn"); // print("Total Expenses: \$$totalEx"); print("Net: \$$net"); // حساب الضريبة if (net > 0) { double tax = net * 0.15; print("Tax to be paid: \$$tax"); } } else if (choice == "4") { print("Exiting application."); break; } } }