Class SavingsGoal

java.lang.Object
no.ntnu.idatt1002.demo.data.budget.SavingsGoal

public class SavingsGoal extends Object
SavingsGoal is a specific goal that you are saving towards, for example a car or holiday.
  • 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

      public SavingsGoal(String description, double amountGoal)
      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

      public String 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

      public void setDescription(String description)
      Setting the description of the SavingsGoal.
      Parameters:
      description - the new description you want to use.
    • setAmountGoal

      public void setAmountGoal(double amount) throws IllegalArgumentException
      Setting the amountGoal of the SavingsGoal.
      Parameters:
      amount - the new amount you want to use.
      Throws:
      IllegalArgumentException
    • addAmountInvested

      public void addAmountInvested(double amount) throws IllegalArgumentException
      Adding an amount to the amountInvested of the SavingsGoal.
      Parameters:
      amount - the amount you want to add.
      Throws:
      IllegalArgumentException