Skip to content

Commit

Permalink
fix: Fixed calculateCost() method in Food entity
Browse files Browse the repository at this point in the history
- applied multiply() method instead type manual castings
  • Loading branch information
koreanMike513 committed Dec 28, 2024
1 parent 405fa00 commit bf5ab8e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/com/f_lab/la_planete/domain/Food.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static Food of(BigDecimal price, int totalQuantity) {
}

public BigDecimal calculateCost(int quantity) {
return BigDecimal.valueOf((long) price.intValue() * quantity);
return price.multiply(BigDecimal.valueOf(quantity));
}

public void minusQuantity(int deductions) {
Expand Down

0 comments on commit bf5ab8e

Please sign in to comment.