Class Income
java.lang.Object
no.ntnu.idatt1002.demo.data.economics.Item
no.ntnu.idatt1002.demo.data.economics.Income
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 Summary
PropertiesTypePropertyDescriptionjavafx.beans.property.ObjectProperty<IncomeCategory>
Gets the ObjectProperty of the category value.Properties inherited from class no.ntnu.idatt1002.demo.data.economics.Item
amount, date, description, recurring
-
Constructor Summary
ConstructorsConstructorDescriptionIncome
(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.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. -
Method Summary
Modifier and TypeMethodDescriptionboolean
The method returns the category to which the Income belongs as a value of the IncomeCategory enum.int
hashCode()
javafx.beans.property.ObjectProperty<IncomeCategory>
Gets the ObjectProperty of the category value.void
setCategory
(IncomeCategory category) The method sets the category of an item to a value of the Category enum class.toString()
Returns a String that represents the Income.Methods inherited from class no.ntnu.idatt1002.demo.data.economics.Item
amountProperty, dateProperty, descriptionProperty, getAmount, getDate, getDescription, isRecurring, recurringProperty, setAmount, setDate, setDescription, setRecurring
-
Property Details
-
incomeCategoryObject
Gets the ObjectProperty of the category value.- See Also:
-
-
Constructor Details
-
Income
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
Gets the ObjectProperty of the category value.- Returns:
- The property of the income category.
-
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
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
Returns a String that represents the Income. Also includes the IncomeCategory -
equals
-
hashCode
public int hashCode()
-