Skip to content

Commit

Permalink
Add negative to outflow in transaction file
Browse files Browse the repository at this point in the history
To satisfy Gradle requirements
  • Loading branch information
ChongXern committed Mar 22, 2024
1 parent a58ba0b commit ac44b10
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/java/financialtransactions/Transaction.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ public String toString() {
}

public String toSave() {
if (this instanceof Outflow) {
amount *= -1;
}
return String.format("%s|%.2f|%s|%s\n", name, amount, date.toString(), category);
}
}

0 comments on commit ac44b10

Please sign in to comment.