Skip to content

Commit

Permalink
introduce shipping getter
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiosilveira committed Aug 20, 2022
1 parent 9844be3 commit 02cf861
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 @@ -19,6 +19,10 @@ class Order {
return Math.max(0, this.quantity - 500) * this.itemPrice * 0.05;
}

get shipping() {
return Math.min(this.quantity * this.itemPrice * 0.1, 100);
}

get price() {
return (
this.basePrice - this.quantityDiscount + Math.min(this.quantity * this.itemPrice * 0.1, 100)
Expand Down

0 comments on commit 02cf861

Please sign in to comment.