Skip to content

Commit 18a5dba

Browse files
committed
Refactor: discover Subscriptions and Unit Price
1 parent ae76289 commit 18a5dba

File tree

1 file changed

+5
-5
lines changed
  • exercises/tiered_pricing/solutions/mperezi/src/main/java/tv/codely/checkout

1 file changed

+5
-5
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package tv.codely.checkout;
22

33
public class TieredPricing {
4-
public double totalPrice(int i) {
5-
if (i == 1) {
6-
return 299.0;
7-
}
8-
return 598.0;
4+
5+
private static final double UNIT_PRICE = 299.0;
6+
7+
public double totalPrice(int subscriptions) {
8+
return subscriptions * UNIT_PRICE;
99
}
1010
}

0 commit comments

Comments
 (0)