Skip to content

Instantly share code, notes, and snippets.

@mickaelw

mickaelw/basket.ts

Last active Mar 1, 2020
Embed
What would you like to do?
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