Advertisement
Guest User

111

a guest
Dec 17th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.37 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 ConsoleApp1
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.        
  14.            
  15.            
  16.             Console.WriteLine("Which currency you want to convert");
  17.             Start:
  18.             string currency = Console.ReadLine().ToLower();
  19.             {            
  20.                            
  21.                 switch (currency)
  22.                 {
  23.                     case "usd":
  24.                        
  25.                         break;
  26.                     case "bgn":
  27.                        
  28.                         break;
  29.                     case "eur":
  30.                        
  31.                         break;
  32.                     case "hkd":
  33.  
  34.                         break;
  35.                     case "cad":
  36.  
  37.                         break;
  38.                     case "gbp":
  39.  
  40.                         break;
  41.                     case "rub":
  42.  
  43.                         break;
  44.                     default:
  45.                         Console.WriteLine("Please Input valid currency");
  46.                          goto Start
  47.                         ;                      
  48.                 }
  49.             }                          
  50.                 Console.Write($"You are converting {currency} to ");
  51.                 string second = Convert.ToString(Console.ReadLine());
  52.             if (second == currency)
  53.             {
  54.                 Console.WriteLine("You cant convert the same currencies");
  55.                 goto Start
  56.                     ;
  57.             }              
  58.                 double BGNUSD = 0.60;
  59.                 double EURUSD = 1.174;
  60.                 double HKDUSD = 0.1280;
  61.                 double CADUSD = 0.7772;
  62.                 double GBPUSD = 1.3322;
  63.                 double RUBUSD = 0.017;
  64.                 double convert;
  65.                 double percentage=0;
  66.  
  67.  
  68.             Console.WriteLine("How much do you want ot convert");
  69.                 var value = Math.Abs(Int32.Parse(Console.ReadLine()));                                                            
  70.                 switch (currency)
  71.                     {
  72.                     case "eur":                      
  73.                         percentage = EURUSD;
  74.                         break;
  75.                     case "bgn":
  76.                         percentage = BGNUSD;
  77.                         break;
  78.                     case "hkd":
  79.                         percentage = HKDUSD;
  80.                         break;
  81.                     case "cad":
  82.                         percentage = CADUSD;
  83.                         break;
  84.                     case "gbp":
  85.                         percentage = GBPUSD;
  86.                        
  87.                         break;
  88.                     case "rub":
  89.                         percentage = RUBUSD;                    
  90.                     break;
  91.                     case "usd":
  92.                     break;
  93.                 default:
  94.                     percentage = 2;
  95.                     break;                      
  96.                     };
  97.             Console.WriteLine(percentage);
  98.  
  99.  
  100.  
  101.                 {
  102.                    
  103.                     //Console.WriteLine($"{value} USD is {value * ratioUSDBGN} BGN");
  104.  
  105.                 }
  106.  
  107.  
  108.  
  109.  
  110.  
  111.                 }
  112.  
  113.  
  114.  
  115.  
  116.  
  117.             }
  118.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement