java.lang.Object
no.ntnu.idatt1002.demo.data.economics.Item
no.ntnu.idatt1002.demo.data.economics.Income

public class Income extends Item
The Income class inherits from the Item class. The Item class additionally has a private field for an enum value of IncomeCategory.
Author:
Hanne-Sofie
  • Property Details

  • Constructor Details

    • Income

      public Income(double amount, boolean recurring, IncomeCategory category, LocalDate date)
      This constructor uses the super constructor to set the fields for 'amount' and 'recurring' and then sets the category. A IllegalArgumentException from this constructor if the category is left blank. The description field is left to the default blank string.
      Parameters:
      amount - The amount of the current income object as a double.
      recurring - True if the current income repeats at regular intervals.
      category - The category to which the Income belongs to, provided as a value of IncomeCategory.
      date - The date of the Income at format "dd.mm.yy".
    • Income

      public Income(String description, double amount, boolean recurring, IncomeCategory category, LocalDate date)
      This constructor uses the super constructor to set the fields for 'amount', 'description' and 'recurring' and then sets the category. A IllegalArgumentException from this constructor if the category is left blank.
      Parameters:
      description - A description of the income as a String.
      amount - The amount of the current income object as a double.
      recurring - True if the current income repeats at regular intervals.
      category - The category to which the income belongs to, provided as a value of IncomeCategory.
      date - The date of the Income at format "dd.mm.yy".
  • Method Details

    • incomeCategoryObjectProperty

      public javafx.beans.property.ObjectProperty<IncomeCategory> incomeCategoryObjectProperty()
      Gets the ObjectProperty of the category value.
      Returns:
      The property of the income category.
    • getCategory

      public IncomeCategory getCategory()
      The method returns the category to which the Income belongs as a value of the IncomeCategory enum.
      Returns:
      The category to which the Income belongs to as a value of the IncomeCategory enum.
    • setCategory

      public void setCategory(IncomeCategory category)
      The method sets the category of an item to a value of the Category enum class.
      Parameters:
      category - The category to which the Income belongs to as a value of the IncomeCategory enum.
    • toString

      public String toString()
      Returns a String that represents the Income. Also includes the IncomeCategory
      Overrides:
      toString in class Item
      Returns:
      The Income as a String
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Item
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Item