Class SavingsGoal
java.lang.Object
no.ntnu.idatt1002.demo.data.budget.SavingsGoal
SavingsGoal is a specific goal that you are saving towards, for example a car or holiday.
-
Constructor Summary
ConstructorsConstructorDescriptionSavingsGoal
(String description, double amountGoal) The class constructor for a SavingsGoal, amountInvested is set to zero.SavingsGoal
(String description, double amountInvested, double amountGoal) The class constructor for a SavingsGoal. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAmountInvested
(double amount) Adding an amount to the amountInvested of the SavingsGoal.double
Getting the amount needed to achieve the SavingsGoal.double
Getting the amount invested into the SavingsGoal.Getting the description of the SavingsGoal.boolean
Check if the SavingsGoal is achieved.void
setAmountGoal
(double amount) Setting the amountGoal of the SavingsGoal.void
setDescription
(String description) Setting the description of the SavingsGoal.
-
Constructor Details
-
SavingsGoal
public SavingsGoal(String description, double amountInvested, double amountGoal) throws IllegalArgumentException The class constructor for a SavingsGoal.- Parameters:
description
- a String the explains what the SavingsGoal is for.amountInvested
- the monetary amount invested into the SavingsGoal.amountGoal
- the monetary amount needed to achieve the SavingsGoal.- Throws:
IllegalArgumentException
-
SavingsGoal
The class constructor for a SavingsGoal, amountInvested is set to zero.- Parameters:
description
- a String the explains what the SavingsGoal is for.amountGoal
- the monetary amount needed to achieve the SavingsGoal.
-
-
Method Details
-
getDescription
Getting the description of the SavingsGoal.- Returns:
- the SavingsGoal´s description.
-
getAmountGoal
public double getAmountGoal()Getting the amount needed to achieve the SavingsGoal.- Returns:
- the SavingsGoal´s needed amount.
-
getAmountInvested
public double getAmountInvested()Getting the amount invested into the SavingsGoal.- Returns:
- the SavingsGoal´s amount invested.
-
isAchieved
public boolean isAchieved()Check if the SavingsGoal is achieved.- Returns:
- boolean
-
setDescription
Setting the description of the SavingsGoal.- Parameters:
description
- the new description you want to use.
-
setAmountGoal
Setting the amountGoal of the SavingsGoal.- Parameters:
amount
- the new amount you want to use.- Throws:
IllegalArgumentException
-
addAmountInvested
Adding an amount to the amountInvested of the SavingsGoal.- Parameters:
amount
- the amount you want to add.- Throws:
IllegalArgumentException
-