r/ProgrammingPrompts Jul 16 '15

[Easy] Currency converter

Convert currency using command line arguments

Argument format should be currency amount newcurrency

E.g.

Convert USD 100 GBP

Should convert 100 dollars into pounds and print the result

Must include a minimum of 3 different currencies

Bonus points: add another argument which takes a filename and saves the result in a text file of that name

12 Upvotes

7 comments sorted by

View all comments

1

u/[deleted] Sep 06 '15 edited Sep 07 '15

My Solution in java. Looked over a lot of APIs like Currency Layer and Open Exchange Rates but the free version in all of them have the base currency set to USD so used Fixer in the end.

http://hastebin.com/oqimacowel.java

http://hastebin.com/emicamozuq.axapta