Attributes:
addExpense(Expense e)
: Adds an Expense object to the expenses list.Methods:
Getters and Setters:
getName()
and setName(String n)
: Access and modify the budget's name.getLimit()
and setLimit(double lim)
: Access and modify the spending limit.Expense Management:
getExpenses()
: Returns the list of expenses.Spending Calculation:
getSpent()
: Calculates the total amount spent by summing up the amounts of all expenses in the expenses list using the sum method of LinkedList.With Expense:
addExpense
method allows adding expenses to the budget, and getSpent
calculates the total amount spent based on these expenses.With LinkedList: