Exemplo n.º 1
0
        public static void Dialogue(string[] args)
        {
            var currentEuro   = CurrencyFormat.FormattingCurrency(dollarEuro.ToString(), Convert.currencyCharacters[0]); //changes currency to appropriate format
            var currentDollar = CurrencyFormat.FormattingCurrency(euroDollar.ToString(), Convert.currencyCharacters[1]); //changes currency to appropriate format



            Console.WriteLine("\nThese are the current available conversion tables\n" +
                              "1€ is " + currentDollar + " Dollar\n" +
                              "$1 is " + currentEuro + " Euro");

            SelectionMenu.RestartDialogue(args);
        }
Exemplo n.º 2
0
        public static void Dialogue(string[] args)
        {
            Console.Write("\nWhat is the currency you want to convert from? (Available: 'Euro', 'Dollar') "); //Asks and reads the currency to convert from
            var currencyInputFrom = Console.ReadLine();

            if (currencyInputFrom == "Euro" || currencyInputFrom == "euro" || currencyInputFrom == "€")
            {
                _valueIn = 0;
            }
            if (currencyInputFrom == "Dollar" || currencyInputFrom == "dollar" || currencyInputFrom == "$")
            {
                _valueIn = 1;
            }


            Console.Write("What is the currency you want to convert to? (Available: 'Euro', 'Dollar') "); //Asks and reads the currency to convert to
            var currencyInputTo = Console.ReadLine();

            if (currencyInputTo == "Euro" || currencyInputTo == "euro" || currencyInputTo == "€")
            {
                _valueOut = 0;
            }
            if (currencyInputTo == "Dollar" || currencyInputTo == "dollar" || currencyInputTo == "$")
            {
                _valueOut = 1;
            }

            Console.Write("\nAmount? ");
            var amountString = Console.ReadLine(); //Asks and reads the amount of money to convert to.

            _amount = System.Convert.ToDecimal(amountString);
            if (_valueIn == 0) //If the currency to exchange from is Euro, the comma is being replaced with a period to allow calculations.
            {
                _amount = System.Convert.ToDecimal(amountString.Replace(",", "."));
            }

            Convert exchanger   = new Convert();
            var     output      = exchanger.ConvertCurrency(_amount, _valueIn, _valueOut);                //converts the amount from the given input to the given output
            var     exchangeIn  = CurrencyFormat.FormattingCurrency(_amount.ToString(), _currencyInChar); //changes currency to appropriate format
            var     exchangeOut = CurrencyFormat.FormattingCurrency(output.ToString(), _currencyOutChar); //changes currency to appropriate format


            Console.WriteLine("\n" + exchangeIn + " is " + exchangeOut);

            SelectionMenu.RestartDialogue(args);
        }
Exemplo n.º 3
0
 static void Main(string[] args)
 {
     Console.OutputEncoding = System.Text.Encoding.UTF8;
     SelectionMenu.Menu(args);
 }