SimeonSheytanov

Currency Conventer - Dictionary

Jan 31st, 2016
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.90 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace TeamsOrganizer
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Dictionary<string, decimal> currencyDetails = new Dictionary<string, decimal>();
  14.  
  15.             currencyDetails.Add("USD", 1.7435m);
  16.             currencyDetails.Add("EUR", 1.954m);
  17.             currencyDetails.Add("GBP", 2.6435m);
  18.             currencyDetails.Add("BGN", 1m);
  19.  
  20.             decimal money = decimal.Parse(Console.ReadLine());
  21.             string currency = Console.ReadLine();
  22.             string wantedCurrency = Console.ReadLine();
  23.  
  24.             decimal moneyInLeva = money * currencyDetails[currency];
  25.             decimal moneyResult = moneyInLeva / currencyDetails[wantedCurrency ];
  26.             Console.WriteLine(moneyResult);
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment