We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7d3e387 commit 878fb89Copy full SHA for 878fb89
exercises/graduated_tiered_prices/solutions/adrianliz/src/GraduatedTieredPricing.ts
@@ -1,14 +1,14 @@
1
export default class GraduatedTieredPricing {
2
priceFor(subscriptions: number): number {
3
- if (subscriptions === 1) {
4
- return 299;
+ const step1Price = 299;
+ const step2Price = 239;
5
+
6
+ if (subscriptions <= 2) {
7
+ return subscriptions * step1Price;
8
}
- if (subscriptions === 2) {
- return 598;
9
+ if (subscriptions <= 5) {
10
+ return 2 * step1Price + (subscriptions - 2) * step2Price;
11
- if (subscriptions === 3) {
- return 837;
- }
12
- return 0;
+ throw new Error("Not implemented yet");
13
14
0 commit comments