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 e87ac9b commit 5b9e07dCopy full SHA for 5b9e07d
exercises/tiered_pricing/solutions/mperezi/src/main/java/tv/codely/checkout/TieredPricing.java
@@ -15,12 +15,16 @@ private enum Tier {
15
}
16
17
public double totalPrice(int subscriptions) {
18
+ return subscriptions * getTier(subscriptions).unitPrice;
19
+ }
20
+
21
+ private Tier getTier(int subscriptions) {
22
if (subscriptions < 3) {
- return subscriptions * Tier.FIRST.unitPrice;
23
+ return Tier.FIRST;
24
25
if (subscriptions < 11) {
- return subscriptions * Tier.SECOND.unitPrice;
26
+ return Tier.SECOND;
27
- return subscriptions * Tier.THIRD.unitPrice;
28
+ return Tier.THIRD;
29
30
0 commit comments