In 2022, the football fans will come to Qatar bringing their foreign currencies. The Ministry of Commerce needs a program that converts foreign currencies from and to Qatari Riyals.
1.1 From foreign currencies to Qatari Riyal [2.5 points]
Write a function toQAR(amount, currency) that takes an amount (number) and a foreign currency (string) as arguments and returns the corresponding amount in Qatari Riyal (as a number)).
• amount is the amount in the foreign currency. • currency can be either "USD", "CYN", "EURO" and 2 other currency codes of your choice.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
29 | 30 | 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 1 | 2 |