Class Overview
java.lang.Object
no.ntnu.idatt1002.demo.data.economics.Overview
Class for getting an overview on your total revenue.
- Author:
- andreas
-
Constructor Summary
ConstructorsConstructorDescriptionOverview
(GeneralBudget budget) Class constructor that take in a GeneralBudget and creates an empty incomeRegister, expenseRegister and set totalRevenue to zero.Overview
(IncomeRegister incomeRegister, ExpenseRegister expenseRegister, GeneralBudget budget) Class constructor that takes in an incomeRegister and expenseRegister and calculates total balance based on them. -
Method Summary
Modifier and TypeMethodDescriptionGet the GeneralBudget of the Overview.double
getBudgetItemMinusExpense
(ExpenseCategory category) Method for getting Expense subtracted from a BudgetItem for a specific ExpenseCategory.Get the ExpenseRegister of the Overview.Get the IncomeRegister of the Overview.double
getPercentageOfTotalBalance
(double percentage) Method for getting a percentage of the total revenue.double
Get the total revenue of overview.boolean
hasUsedUpBudgetItem
(ExpenseCategory category) Method for checking if you have used up a specific BudgetItem.void
Method for updating the total balance by taking the max amount of the budget minus the total sum of the expense register.
-
Constructor Details
-
Overview
Class constructor that take in a GeneralBudget and creates an empty incomeRegister, expenseRegister and set totalRevenue to zero.- Parameters:
budget
- the GeneralBudget you want to overview.
-
Overview
public Overview(IncomeRegister incomeRegister, ExpenseRegister expenseRegister, GeneralBudget budget) Class constructor that takes in an incomeRegister and expenseRegister and calculates total balance based on them.- Parameters:
incomeRegister
- the incomeRegister you want to overview.expenseRegister
- the expenseRegister you want to overview.budget
- the GeneralBudget you want to overview.
-
-
Method Details
-
getIncomeRegister
Get the IncomeRegister of the Overview.- Returns:
- IncomeRegister
-
getExpenseRegister
Get the ExpenseRegister of the Overview.- Returns:
- ExpenseRegister
-
getBudget
Get the GeneralBudget of the Overview.- Returns:
- GeneralBudget
-
getTotalBalance
public double getTotalBalance()Get the total revenue of overview.- Returns:
- the overview´s total revenue.
-
updateBalance
public void updateBalance()Method for updating the total balance by taking the max amount of the budget minus the total sum of the expense register. -
getPercentageOfTotalBalance
public double getPercentageOfTotalBalance(double percentage) Method for getting a percentage of the total revenue.- Parameters:
percentage
- the percentage you want to get.- Returns:
- a percentage of total revenue.
-
getBudgetItemMinusExpense
Method for getting Expense subtracted from a BudgetItem for a specific ExpenseCategory.- Parameters:
category
- the ExpenseCategory you want to use.- Returns:
- Expense subtracted from BudgetItem for category.
- Throws:
IllegalArgumentException
- if there is no Budget for budget category.
-
hasUsedUpBudgetItem
Method for checking if you have used up a specific BudgetItem.- Parameters:
category
- the ExpenseCategory you want to check.- Returns:
- true or false depending on if you have used it up.
-