Skip to content

Commit

Permalink
introduce quantityDiscount getter
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiosilveira committed Aug 20, 2022
1 parent 50242dc commit 725105d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions order.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ class Order {
return this.quantity * this.itemPrice;
}

get quantityDiscount() {
return Math.max(0, this.quantity - 500) * this.itemPrice * 0.05;
}

get price() {
return (
this.basePrice -
Expand Down

0 comments on commit 725105d

Please sign in to comment.