import 'dart:io'; void main(){ Map incomes ={}; Map expenses ={}; print("welcome to Budget Managment Aplication"); while(true){ print("1. Add income"); print("2. Add expense"); print("3. View summary"); print("4.Exit"); print("Enter your choice"); String? choice = stdin.readLineSync(); if (choice=="1") { print("Enter income source: "); String? source = stdin.readLineSync(); double amount = 0; while(true){ print("Enter income amount"); String? input = stdin.readLineSync(); double? value = double.tryParse(input??""); if (value!=null && value>0){ amount=value; break; } else{ print("please enter avalid positive mumber!"); } } incomes[source?? "unnamd Income"] = amount; } else if(choice =="2"){ print ("enter expense description :"); String?desc= stdin.readLineSync(); double? amount; while (true) { print("Enter expens amount"); String? input = stdin.readLineSync(); amount= double.parse(input?? ""); if ( amount>0) break; }print("please enter avalid positive mumber!"); expenses[desc??"unnamd expese" ]= amount; }else if(choice =="3"){ double totalincome =incomes.values.fold(0,(sum,amount)=> sum + amount); double totalexpense = expenses.values.fold(0,(sum , amount)=>sum + amount); double net = totalincome -totalexpense; print(".....budget Summary....."); print("Total income : ${totalincome}"); print("total expense:${totalexpense}"); print("net profit : ${net}"); if (net>0){ double tax =net * 0.15 ; print("tax(15%): $tax"); } else print("no profit no tax"); }else if (choice=="4"){ print ("Exiting the program . Goodbye!"); }break; } }