From 9fe12cdfb9b0e1576c674b0db227f0904d71355b Mon Sep 17 00:00:00 2001 From: Safwan Samsudeen Date: Sat, 29 Apr 2023 09:15:50 +0530 Subject: [PATCH 1/4] sync exercise --- .../practice/book-store/.docs/instructions.md | 41 ++++++++----------- .../practice/book-store/.meta/tests.toml | 27 +++++++++--- 2 files changed, 38 insertions(+), 30 deletions(-) diff --git a/exercises/practice/book-store/.docs/instructions.md b/exercises/practice/book-store/.docs/instructions.md index 5d767b0360..906eb58761 100644 --- a/exercises/practice/book-store/.docs/instructions.md +++ b/exercises/practice/book-store/.docs/instructions.md @@ -1,12 +1,10 @@ -# Description +# Instructions -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. +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. One copy of any of the five books costs $8. -If, however, you buy two different books, you get a 5% -discount on those two books. +If, however, you buy two different books, you get a 5% discount on those two books. If you buy 3 different books, you get a 10% discount. @@ -14,14 +12,9 @@ If you buy 4 different books, you get a 20% discount. If you buy all 5, you get a 25% discount. -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. +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. -Your mission is to write a piece of code to calculate the -price of any conceivable shopping basket (containing only -books of the same series), giving as big a discount as -possible. +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. For example, how much does this basket of books cost? @@ -33,36 +26,36 @@ For example, how much does this basket of books cost? One way of grouping these 8 books is: -- 1 group of 5 --> 25% discount (1st,2nd,3rd,4th,5th) -- +1 group of 3 --> 10% discount (1st,2nd,3rd) +- 1 group of 5 (1st, 2nd,3rd, 4th, 5th) +- 1 group of 3 (1st, 2nd, 3rd) This would give a total of: - 5 books at a 25% discount -- +3 books at a 10% discount +- 3 books at a 10% discount Resulting in: -- 5 _ (8 - 2.00) == 5 _ 6.00 == $30.00 -- +3 _ (8 - 0.80) == 3 _ 7.20 == $21.60 +- 5 × (100% - 25%) * $8 = 5 × $6.00 = $30.00, plus +- 3 × (100% - 10%) * $8 = 3 × $7.20 = $21.60 -For a total of $51.60 +Which equals $51.60. However, a different way to group these 8 books is: -- 1 group of 4 books --> 20% discount (1st,2nd,3rd,4th) -- +1 group of 4 books --> 20% discount (1st,2nd,3rd,5th) +- 1 group of 4 books (1st, 2nd, 3rd, 4th) +- 1 group of 4 books (1st, 2nd, 3rd, 5th) This would give a total of: - 4 books at a 20% discount -- +4 books at a 20% discount +- 4 books at a 20% discount Resulting in: -- 4 _ (8 - 1.60) == 4 _ 6.40 == $25.60 -- +4 _ (8 - 1.60) == 4 _ 6.40 == $25.60 +- 4 × (100% - 20%) * $8 = 4 × $6.40 = $25.60, plus +- 4 × (100% - 20%) * $8 = 4 × $6.40 = $25.60 -For a total of $51.20 +Which equals $51.20. And $51.20 is the price with the biggest discount. diff --git a/exercises/practice/book-store/.meta/tests.toml b/exercises/practice/book-store/.meta/tests.toml index 70d3f906a5..8241ee55f2 100644 --- a/exercises/practice/book-store/.meta/tests.toml +++ b/exercises/practice/book-store/.meta/tests.toml @@ -1,6 +1,13 @@ -# This is an auto-generated file. Regular comments will be removed when this -# file is regenerated. Regenerating will not touch any manually added keys, -# so comments can be added in a "comment" key. +# This is an auto-generated file. +# +# Regenerating this file via `configlet sync` will: +# - Recreate every `description` key/value pair +# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications +# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion) +# - Preserve any other key/value pair +# +# As user-added comments (using the # character) will be removed when this file +# is regenerated, comments can be added via a `comment` key. [17146bd5-2e80-4557-ab4c-05632b6b0d01] description = "Only a single book" @@ -33,19 +40,27 @@ description = "Two groups of four is cheaper than groups of five and three" description = "Group of four plus group of two is cheaper than two groups of three" [68ea9b78-10ad-420e-a766-836a501d3633] -description = "Two each of first 4 books and 1 copy each of rest" +description = "Two each of first four books and one copy each of rest" [c0a779d5-a40c-47ae-9828-a340e936b866] description = "Two copies of each book" [18fd86fe-08f1-4b68-969b-392b8af20513] -description = "Three copies of first book and 2 each of remaining" +description = "Three copies of first book and two each of remaining" [0b19a24d-e4cf-4ec8-9db2-8899a41af0da] -description = "Three each of first 2 books and 2 each of remaining books" +description = "Three each of first two books and two each of remaining books" [bb376344-4fb2-49ab-ab85-e38d8354a58d] description = "Four groups of four are cheaper than two groups each of five and three" [5260ddde-2703-4915-b45a-e54dbbac4303] description = "Check that groups of four are created properly even when there are more groups of three than groups of five" + +[b0478278-c551-4747-b0fc-7e0be3158b1f] +description = "One group of one and four is cheaper than one group of two and three" +include = false + +[cf868453-6484-4ae1-9dfc-f8ee85bbde01] +description = "One group of one and two plus three groups of four is cheaper than one group of each size" +include = false From 0a75e4bca75b6ebfbd2dfb748e729fdb25361159 Mon Sep 17 00:00:00 2001 From: Safwan Samsudeen Date: Sat, 29 Apr 2023 10:11:38 +0530 Subject: [PATCH 2/4] add for house --- config.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/config.json b/config.json index de7052e2f9..95d9ea9521 100644 --- a/config.json +++ b/config.json @@ -1054,9 +1054,8 @@ "name": "House", "uuid": "a8b7187d-12eb-4efc-b966-87823654ccda", "practices": [], - "prerequisites": [], - "difficulty": 4, - "topics": ["arrays", "conditionals", "loops", "recursion", "strings"] + "prerequisites": ["for-loops", "arrays", "strings"], + "difficulty": 4 }, { "slug": "isbn-verifier", From ff9d166cee504a0c3c0c7e0074720023a478d46d Mon Sep 17 00:00:00 2001 From: Safwan Samsudeen <62411302+safwansamsudeen@users.noreply.github.com> Date: Sat, 29 Apr 2023 10:23:36 +0530 Subject: [PATCH 3/4] revert sync changes --- .../practice/book-store/.docs/instructions.md | 41 +++++++++++-------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/exercises/practice/book-store/.docs/instructions.md b/exercises/practice/book-store/.docs/instructions.md index 906eb58761..5d767b0360 100644 --- a/exercises/practice/book-store/.docs/instructions.md +++ b/exercises/practice/book-store/.docs/instructions.md @@ -1,10 +1,12 @@ -# Instructions +# Description -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. +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. One copy of any of the five books costs $8. -If, however, you buy two different books, you get a 5% discount on those two books. +If, however, you buy two different books, you get a 5% +discount on those two books. If you buy 3 different books, you get a 10% discount. @@ -12,9 +14,14 @@ If you buy 4 different books, you get a 20% discount. If you buy all 5, you get a 25% discount. -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. +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. -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. +Your mission is to write a piece of code to calculate the +price of any conceivable shopping basket (containing only +books of the same series), giving as big a discount as +possible. For example, how much does this basket of books cost? @@ -26,36 +33,36 @@ For example, how much does this basket of books cost? One way of grouping these 8 books is: -- 1 group of 5 (1st, 2nd,3rd, 4th, 5th) -- 1 group of 3 (1st, 2nd, 3rd) +- 1 group of 5 --> 25% discount (1st,2nd,3rd,4th,5th) +- +1 group of 3 --> 10% discount (1st,2nd,3rd) This would give a total of: - 5 books at a 25% discount -- 3 books at a 10% discount +- +3 books at a 10% discount Resulting in: -- 5 × (100% - 25%) * $8 = 5 × $6.00 = $30.00, plus -- 3 × (100% - 10%) * $8 = 3 × $7.20 = $21.60 +- 5 _ (8 - 2.00) == 5 _ 6.00 == $30.00 +- +3 _ (8 - 0.80) == 3 _ 7.20 == $21.60 -Which equals $51.60. +For a total of $51.60 However, a different way to group these 8 books is: -- 1 group of 4 books (1st, 2nd, 3rd, 4th) -- 1 group of 4 books (1st, 2nd, 3rd, 5th) +- 1 group of 4 books --> 20% discount (1st,2nd,3rd,4th) +- +1 group of 4 books --> 20% discount (1st,2nd,3rd,5th) This would give a total of: - 4 books at a 20% discount -- 4 books at a 20% discount +- +4 books at a 20% discount Resulting in: -- 4 × (100% - 20%) * $8 = 4 × $6.40 = $25.60, plus -- 4 × (100% - 20%) * $8 = 4 × $6.40 = $25.60 +- 4 _ (8 - 1.60) == 4 _ 6.40 == $25.60 +- +4 _ (8 - 1.60) == 4 _ 6.40 == $25.60 -Which equals $51.20. +For a total of $51.20 And $51.20 is the price with the biggest discount. From c4f63edcbbf7bba3ae3cb7051fd1fb4ff6de6339 Mon Sep 17 00:00:00 2001 From: Safwan Samsudeen <62411302+safwansamsudeen@users.noreply.github.com> Date: Sat, 29 Apr 2023 10:26:38 +0530 Subject: [PATCH 4/4] revert tests change --- .../practice/book-store/.meta/tests.toml | 27 +++++-------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/exercises/practice/book-store/.meta/tests.toml b/exercises/practice/book-store/.meta/tests.toml index 8241ee55f2..70d3f906a5 100644 --- a/exercises/practice/book-store/.meta/tests.toml +++ b/exercises/practice/book-store/.meta/tests.toml @@ -1,13 +1,6 @@ -# This is an auto-generated file. -# -# Regenerating this file via `configlet sync` will: -# - Recreate every `description` key/value pair -# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications -# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion) -# - Preserve any other key/value pair -# -# As user-added comments (using the # character) will be removed when this file -# is regenerated, comments can be added via a `comment` key. +# This is an auto-generated file. Regular comments will be removed when this +# file is regenerated. Regenerating will not touch any manually added keys, +# so comments can be added in a "comment" key. [17146bd5-2e80-4557-ab4c-05632b6b0d01] description = "Only a single book" @@ -40,27 +33,19 @@ description = "Two groups of four is cheaper than groups of five and three" description = "Group of four plus group of two is cheaper than two groups of three" [68ea9b78-10ad-420e-a766-836a501d3633] -description = "Two each of first four books and one copy each of rest" +description = "Two each of first 4 books and 1 copy each of rest" [c0a779d5-a40c-47ae-9828-a340e936b866] description = "Two copies of each book" [18fd86fe-08f1-4b68-969b-392b8af20513] -description = "Three copies of first book and two each of remaining" +description = "Three copies of first book and 2 each of remaining" [0b19a24d-e4cf-4ec8-9db2-8899a41af0da] -description = "Three each of first two books and two each of remaining books" +description = "Three each of first 2 books and 2 each of remaining books" [bb376344-4fb2-49ab-ab85-e38d8354a58d] description = "Four groups of four are cheaper than two groups each of five and three" [5260ddde-2703-4915-b45a-e54dbbac4303] description = "Check that groups of four are created properly even when there are more groups of three than groups of five" - -[b0478278-c551-4747-b0fc-7e0be3158b1f] -description = "One group of one and four is cheaper than one group of two and three" -include = false - -[cf868453-6484-4ae1-9dfc-f8ee85bbde01] -description = "One group of one and two plus three groups of four is cheaper than one group of each size" -include = false