diff --git a/src/main/java/no/ntnu/idatt1002/demo/Income.java b/src/main/java/no/ntnu/idatt1002/demo/TotalIncomeIdea.java similarity index 94% rename from src/main/java/no/ntnu/idatt1002/demo/Income.java rename to src/main/java/no/ntnu/idatt1002/demo/TotalIncomeIdea.java index 71f3a3a10567ac28c3c1145c4f4e5b195cd3b001..bb87775c2fcbc38806412c626a79bfe4b59a4e08 100644 --- a/src/main/java/no/ntnu/idatt1002/demo/Income.java +++ b/src/main/java/no/ntnu/idatt1002/demo/TotalIncomeIdea.java @@ -5,7 +5,7 @@ package no.ntnu.idatt1002.demo; * and editing it. * @author Andreas */ -public class Income { +public class TotalIncomeIdea { private double totalIncome; private final double fixedIncome; @@ -13,7 +13,7 @@ public class Income { * Class constructor * @param fixedIncome An income which you will always receive, for example a loan. */ - protected Income(double fixedIncome){ + protected TotalIncomeIdea(double fixedIncome){ if(fixedIncome<0){ throw new IllegalArgumentException("You can not have a negativ income"); } diff --git a/src/main/java/no/ntnu/idatt1002/demo/expense.java b/src/main/java/no/ntnu/idatt1002/demo/expense.java new file mode 100644 index 0000000000000000000000000000000000000000..d91f1d6a6e01603ca4d6d1a614662480f4b1b56c --- /dev/null +++ b/src/main/java/no/ntnu/idatt1002/demo/expense.java @@ -0,0 +1,14 @@ +package no.ntnu.idatt1002.demo; + +public class expense extends revenue{ + /** + * The class constructor. + * + * @param category A general explanation for the change in revenue. + * @param description A more specific explanation of the change in revenue. + * @param amount The amount the revenue is changed. + */ + protected expense(String category, String description, double amount) { + super(category, description, amount); + } +} diff --git a/src/main/java/no/ntnu/idatt1002/demo/income.java b/src/main/java/no/ntnu/idatt1002/demo/income.java new file mode 100644 index 0000000000000000000000000000000000000000..d9a2e9f65928b91d89c865255f9e7605c5e92299 --- /dev/null +++ b/src/main/java/no/ntnu/idatt1002/demo/income.java @@ -0,0 +1,14 @@ +package no.ntnu.idatt1002.demo; + +public class income extends revenue{ + /** + * The class constructor. + * + * @param category A general explanation for the change in revenue. + * @param description A more specific explanation of the change in revenue. + * @param amount The amount the revenue is changed. + */ + protected income(String category, String description, double amount) { + super(category, description, amount); + } +} diff --git a/src/main/java/no/ntnu/idatt1002/demo/revenue.java b/src/main/java/no/ntnu/idatt1002/demo/revenue.java new file mode 100644 index 0000000000000000000000000000000000000000..40870cdb364da3e61ef4b4441297d0a648c7f928 --- /dev/null +++ b/src/main/java/no/ntnu/idatt1002/demo/revenue.java @@ -0,0 +1,49 @@ +package no.ntnu.idatt1002.demo; + +/** + * Revenue is a Superclass for both income + * and expense. It is for registering a change in + * revenue. + * @author Andreas + */ +public class revenue { + private String category; + private String description; + private double amount; + + /** + * The class constructor. + * @param category A general explanation for the change in revenue. + * @param description A more specific explanation of the change in revenue. + * @param amount The amount the revenue is changed. + */ + protected revenue(String category, String description, double amount){ + this.category = category; + this.description = description; + this.amount = amount; + } + + /** + * Return the category of the revenue change. + * @return The revenue change category. + */ + public String getCategory() { + return category; + } + + /** + * Return the description of the revenue change. + * @return The revenue change description. + */ + public String getDescription() { + return description; + } + + /** + * Return the amount of the revenue change. + * @return The revenue change amount. + */ + public double getAmount() { + return amount; + } +}