Last active
March 1, 2020 10:22
-
-
Save mickaelw/8c3114a8592ed35aeca9bbd7c23a7e30 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class Basket { | |
//... | |
private applyDiscount(totalOfSameBookBorrowed: number, price: number): number { | |
switch (totalOfSameBookBorrowed) { | |
case 1: | |
return price | |
case 2: | |
return price * (1 - 0.05) | |
default: | |
return price * (1 - 0.25) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment