Skip to content
Snippets Groups Projects
Commit 6f92f8dd authored by Andreas's avatar Andreas
Browse files

Made superclass revenue, and expense and income. Scraped previous income idea

parent 3831b952
No related branches found
No related tags found
1 merge request!4ItemOverview class (with test class)
......@@ -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");
}
......
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);
}
}
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);
}
}
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;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment