Skip to content
Snippets Groups Projects
Commit 8cb7251f authored by Andreas's avatar Andreas
Browse files

Rewrote toString methods in Expense, Income and Item

parent 0d237107
No related branches found
No related tags found
2 merge requests!9Added FileHandling class for ItemRegister objects, and reworked ItemRegister with new subclasses,!8Remade ItemRegister class and made FileHandling for ItemRegister-objects with tests
Pipeline #208268 failed
...@@ -66,6 +66,6 @@ public class Expense extends Item{ ...@@ -66,6 +66,6 @@ public class Expense extends Item{
*/ */
@Override @Override
public String toString() { public String toString() {
return super.toString()+category.toString()+"\n"; return super.toString()+"\ncategory="+category.toString()+"\n";
} }
} }
...@@ -73,6 +73,6 @@ public class Income extends Item{ ...@@ -73,6 +73,6 @@ public class Income extends Item{
*/ */
@Override @Override
public String toString() { public String toString() {
return super.toString()+category.toString()+"\n"; return super.toString()+"\ncategory="+category.toString()+"\n";
} }
} }
...@@ -138,10 +138,10 @@ public abstract class Item { ...@@ -138,10 +138,10 @@ public abstract class Item {
isReoccuring = "Not reoccurring"; isReoccuring = "Not reoccurring";
} }
if(!description.isBlank()){ if(!description.isBlank()){
return "\n"+date+"\n"+description+"\n"+amount+"\n"+isReoccuring+"\n"; return "\ndate=" + date+"\ndescription=" + description+"\namount="+amount+"\nisReoccuring="+isReoccuring;
} }
else{ else{
return "\n"+date+"\n"+amount+"\n"+isReoccuring+"\n"; return "\ndate="+date+"\namount="+amount+"\nisReoccuring="+isReoccuring;
} }
} }
......
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