You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To try and encourage more sales of different books from a popular 5 book
4
-
series, a bookshop has decided to offer discounts on multiple book purchases.
3
+
To try and encourage more sales of different books from a popular 5 book series, a bookshop has decided to offer discounts on multiple book purchases.
5
4
6
5
One copy of any of the five books costs $8.
7
6
8
-
If, however, you buy two different books, you get a 5%
9
-
discount on those two books.
7
+
If, however, you buy two different books, you get a 5% discount on those two books.
10
8
11
9
If you buy 3 different books, you get a 10% discount.
12
10
13
11
If you buy 4 different books, you get a 20% discount.
14
12
15
13
If you buy all 5, you get a 25% discount.
16
14
17
-
Note: that if you buy four books, of which 3 are
18
-
different titles, you get a 10% discount on the 3 that
19
-
form part of a set, but the fourth book still costs $8.
15
+
Note that if you buy four books, of which 3 are different titles, you get a 10% discount on the 3 that form part of a set, but the fourth book still costs $8.
20
16
21
-
Your mission is to write a piece of code to calculate the
22
-
price of any conceivable shopping basket (containing only
23
-
books of the same series), giving as big a discount as
24
-
possible.
17
+
Your mission is to write code to calculate the price of any conceivable shopping basket (containing only books of the same series), giving as big a discount as possible.
25
18
26
19
For example, how much does this basket of books cost?
27
20
@@ -33,36 +26,36 @@ For example, how much does this basket of books cost?
33
26
34
27
One way of grouping these 8 books is:
35
28
36
-
- 1 group of 5 --> 25% discount (1st,2nd,3rd,4th,5th)
Copy file name to clipboardExpand all lines: exercises/practice/book-store/.meta/config.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -28,5 +28,5 @@
28
28
},
29
29
"blurb": "To try and encourage more sales of different books from a popular 5 book series, a bookshop has decided to offer discounts of multiple-book purchases.",
30
30
"source": "Inspired by the harry potter kata from Cyber-Dojo.",
0 commit comments