File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
exercises/tiered_pricing/solutions/mperezi/src
main/java/tv/codely/checkout
test/java/tv/codely/checkout Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,9 @@ public class TieredPricing {
55 private static final double UNIT_PRICE = 299.0 ;
66
77 public double totalPrice (int subscriptions ) {
8- return subscriptions * UNIT_PRICE ;
8+ if (subscriptions < 3 ) {
9+ return subscriptions * UNIT_PRICE ;
10+ }
11+ return 717.0 ;
912 }
1013}
Original file line number Diff line number Diff line change @@ -23,4 +23,13 @@ void returnDoubleTheUnitPriceForTwoSubscriptions() {
2323
2424 assertThat (totalPrice ).isEqualTo (598.0 );
2525 }
26+
27+ @ Test
28+ void returnTripleTheUnitPriceForThreeSubscriptions () {
29+ var tieredPricing = new TieredPricing ();
30+
31+ double totalPrice = tieredPricing .totalPrice (3 );
32+
33+ assertThat (totalPrice ).isEqualTo (717.0 );
34+ }
2635}
You can’t perform that action at this time.
0 commit comments