Agile Staffordshire has a delightful evening of kata and merriment planned (loosely).
As a special treat, there is a choice of kata:
• Secret Santa
• Roman Numeral
Secret Santa
Secret Santa is a modern tradition where one anonymously gives a gift to a randomly assigned recipient. Create code that randomly assigns each Agile Staffordshire participant as a ‘santa’ to another participant as the recipient. Each participant must give and receive one gift.
This is a neat kata, with an added bonus for writing good tests to ensure recipient constraints are met.
Some actual presents will be provided, feel free to bring your own goodies if you wish.
Roman Numeral
The Roman Empire was once mighty and large. I suspect one of the reasons it diminished was due to the clunky number system it employed. We still use Roman numerals occasionally on clocks and BBC credits. Write a small program to decode a string of Roman numerals to its decimal value.
As stated by Rosetta, modern Roman numerals are written by expressing each decimal digit of the number to be encoded separately, starting with the leftmost digit and skipping any 0s. So 1990 is rendered “MCMXC” (1000 = M, 900 = CM, 90 = XC) and 2008 is rendered “MMVIII” (2000 = MM, 8 = VIII). The Roman numeral for 1666, “MDCLXVI”, uses each letter in descending order.
For extra credit, validate the Roman Numeral input string!
Sample Data:
• III – 3
• XXX – 30
• CCC – 300
• MMM – 3000
• VII – 7
• LXVI – 66
• CL – 150
• MCC – 1200
• IV – 4
• IX – 9
• XC – 90
• ICM – 901
• CIM – 899
• MDCLXVI – 1666
Merriment
Upon completion of our Kata session, we shall move out and head to our local eatery. We usually visit Red Hill Brewers Fayre, just off M6 J14 and A34.
Looking forward to it!
T.
{ Comments are closed! }