SHARE
TWEET

Untitled

bpavlov123bp Apr 3rd, 2016 3,070 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace CurrencyConvertorDemo
  4. {
  5.     class Program
  6.     {
  7.         public static void Main(string[] args)
  8.         {
  9.             var amount = double.Parse(Console.ReadLine());
  10.             var inputCurrency = Console.ReadLine();
  11.             var outputCurrency = Console.ReadLine();
  12.             double total = 0;
  13.             switch(inputCurrency)
  14.             {
  15.                 case "USD":
  16.                     switch(outputCurrency)
  17.                     {
  18.                         case "BGN": total = amount * 1.79549; break;
  19.                         case "EUR": total = (amount * 1.79549) / 1.95583; break;
  20.                         case "GBP": total = (amount * 1.79549) / 2.53405; break;
  21.                     }break;
  22.                 case "BGN":
  23.                     switch(outputCurrency)
  24.                     {
  25.                         case "USD": total = amount / 1.79549; break;
  26.                         case "EUR": total = amount / 1.95583; break;
  27.                         case "GBP": total = amount / 2.53405; break;
  28.                     }break;
  29.                 case "EUR":
  30.                     switch(outputCurrency)
  31.                     {
  32.                         case "BGN": total = amount * 1.95583; break;
  33.                         case "USD": total = (amount * 1.95583) / 1.79549; break;
  34.                         case "GBP": total = (amount * 1.95583) / 2.53405; break;
  35.                     }break;
  36.                 case "GBP":
  37.                     switch(outputCurrency)
  38.                     {
  39.                         case "BGN": total = amount * 2.53405; break;
  40.                         case "USD": total = (amount * 2.53405) / 1.79549; break;
  41.                         case "EUR": total = (amount * 2.53405) / 1.95583; break;
  42.                     }break;
  43.             }
  44.             Console.WriteLine("{0:f2} {1}", total, outputCurrency);
  45.             Console.Write("Press any key to continue . . . ");
  46.             Console.ReadKey(true);
  47.         }
  48.     }
  49. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top