32
8
Until decimalization in 1971, British money was based on dividing the pound into 240 pennies. A shilling was 12 pennies so 20 shillings made a pound. The smallest denomination was the farthing at one fourth of a penny. There were many other denominations and nicknames for coins, which can get quite confusing if you're not used to the system.
Challenge
Write a program or function that can convert (almost) any denomination of old English money to any other. To make it easier for the user you need to support plurals and nicknames.
These are the denominations and their synonymous terms you must support. For convenience their value in farthings leads each line.
1: farthing, farthings
2: halfpence, halfpenny, halfpennies
4: penny, pennies, pence, copper, coppers
8: twopenny, twopennies, twopence, tuppence, half groat, half groats
12: threepence, threepenny, threepennies, threepenny bit, threepenny bits, thruppence, thrupenny, thrupennies, thrupenny bit, thrupenny bits
16: groat, groats
24: sixpence, sixpenny, sixpennies, sixpenny bit, sixpenny bits, tanner, tanners
48: shilling, shillings, bob
96: florin, florins, two bob bit, two bob bits
120: half crown, half crowns
240: crown, crowns
480: half sovereign, half sovereigns
504: half guinea, half guineas
960: pound, pounds, pounds sterling, sovereign, sovereigns, quid, quids
1008: guinea, guineas
(I am not British, this list is by no means authoritative but it will suffice for the challenge.)
Via stdin or function argument you should take in a string of the form
[value to convert] [denomination 1] in [denomination 2]
and return or print
[value to convert] [denomination 1] is [converted value] [denomination 2]
where [converted value]
is [value to convert]
units of denomination 1 converted to denomination 2.
The [value to convert]
and [converted value]
are positive floats. In the output both should be rounded or truncated to 4 decimal places. If desired you may assume [value to convert]
always has a decimal point and zero when input (e.g. 1.0
instead of 1
).
Denominations 1 and 2 may be any two terms from the list above. Don't worry about whether they're plural or not, treat all denominations and synonyms the same. You may assume the input format and denominations are always valid.
Examples
1 pounds in shilling
→ 1 pounds is 20 shilling
(1.0000 pounds is 20.0000 shilling
would be fine)
0.6 tuppence in tanner
→ 0.6 tuppence is 0.2 tanner
24 two bob bits in pounds sterling
→ 24 two bob bits is 2.4 pounds sterling
144 threepennies in guineas
→ 144 threepennies is 1.7143 guineas
Scoring
The shortest code in bytes wins.
1"pennies" is only ever used to refer to a number of coins, not an amount of money. – David Richerby – 2014-11-03T19:45:54.877
4
Nit-pick: Post decimalisation, the plural of
– Digital Trauma – 2014-11-03T21:30:44.230quid
isquid
. Most likely this would have been the same with the old money. Example:Five quid a pint! Cor blimey guvnor
. Exception: quids-in7I would probably mess alot of people up to require them to include "ha'penny". – kaine – 2014-11-03T21:51:18.487
3
I've never heard a ha'penny called anything but a ha'penny, @kaine. As in http://en.wikipedia.org/wiki/Ha%27penny_Bridge. Of course, I'm too young meself to have heard it too often in speech, but the apostrophe seems standard in writing.
– TRiG – 2014-11-03T23:35:28.113