nvnnaidenov

CurrencyConverter - 2.0

Feb 9th, 2022
970
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.00 KB | None | 0 0
  1. //Task 012, Chapter 2.0
  2. using System;
  3.  
  4. public class CurrencyConverter
  5. {
  6.     static void Main()
  7.     {
  8.         double amount = double.Parse(Console.ReadLine());
  9.         string currentCurrency = Console.ReadLine().ToLower();
  10.         string wantedCurrecncy = Console.ReadLine().ToLower();
  11.         double total = 0.0;
  12.  
  13.         if(currentCurrency == "bgn" && wantedCurrecncy == "eur")
  14.         {
  15.             total = amount / 1.95583;
  16.         }
  17.         else if(currentCurrency == "bgn" && wantedCurrecncy == "gbp")
  18.         {
  19.             total = amount / 2.53405;
  20.         }
  21.         else if(currentCurrency == "bgn" && wantedCurrecncy == "usd")
  22.         {
  23.             total = amount / 1.79549;
  24.         }
  25.         else if(currentCurrency == "eur" && wantedCurrecncy == "bgn")
  26.         {
  27.             total = amount * 1.95583;
  28.         }
  29.         else if(currentCurrency == "eur" && wantedCurrecncy == "gbp")
  30.         {
  31.             total = amount * 1.95583 / 2.53405;
  32.         }
  33.         else if(currentCurrency == "eur" && wantedCurrecncy == "usd")
  34.         {
  35.             total = amount * 1.95583 / 1.79549;
  36.         }
  37.         else if(currentCurrency == "gbp" && wantedCurrecncy == "bgn")
  38.         {
  39.             total = amount * 2.53405;
  40.         }
  41.         else if(currentCurrency == "gbp" && wantedCurrecncy == "eur")
  42.         {
  43.             total = amount * 2.53405 / 1.95583;
  44.         }
  45.         else if(currentCurrency == "gbp" && wantedCurrecncy == "usd")
  46.         {
  47.             total = amount * 2.53405 / 1.79549;
  48.         }
  49.         else if(currentCurrency == "usd" && wantedCurrecncy == "bgn")
  50.         {
  51.             total = amount * 1.79549;
  52.         }
  53.         else if(currentCurrency == "usd" && wantedCurrecncy == "eur")
  54.         {
  55.             total = amount * 1.79549 / 1.95583;
  56.         }
  57.         else if(currentCurrency == "usd" && wantedCurrecncy == "gbp")
  58.         {
  59.             total = amount * 1.79549 / 2.53405;
  60.         }
  61.  
  62.         Console.WriteLine($"{total:F2} {wantedCurrecncy.ToUpper()}");
  63.     }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment