static void Main(string[] args)
        {
            Money m1 = new Money(14.50, CURRENCY.EURO);
            Money m2 = new Money(29.13, CURRENCY.USDOLLARS);
            Money m3 = new Money(2.33, CURRENCY.YEN);

            Console.WriteLine("Euro :: " + m1.Amount + " to USD is :: " + m1.Convert(CURRENCY.USDOLLARS));
            Console.WriteLine("Euro :: " + m1.Amount + " to YEN is :: " + m1.Convert(CURRENCY.YEN));
            Console.WriteLine();

            Console.WriteLine("Yen :: " + m3.Amount + " to USD is :: " + m3.Convert(CURRENCY.USDOLLARS));
            Console.WriteLine("Yen :: " + m3.Amount + " to EURO is :: " + m3.Convert(CURRENCY.EURO));
            Console.WriteLine();

            Console.WriteLine("USD :: " + m2.Amount + " to EURO is :: " + m2.Convert(CURRENCY.EURO));
            Console.WriteLine("USD :: " + m2.Amount + " to YEN is :: " + m2.Convert(CURRENCY.YEN));
            Console.WriteLine();

            //Adding two Money objects together

            Money a = new Money(13.99, CURRENCY.EURO);
            Money b = new Money(99.34, CURRENCY.USDOLLARS);

            Console.WriteLine("Euro :: " + a.Amount + " + USD :: " + b.Amount + " = Euro :: " + (a + b).Amount);

            Console.Read();
        }
Beispiel #2
0
        static void Main(string[] args)
        {

            var dollar = new Money(CurrencyTypes.Dollar, 20.0);
            Console.WriteLine(dollar.ToString());
            var euro = new Money(CurrencyTypes.Euro, dollar.Conversion(CurrencyTypes.Euro));
            Console.WriteLine(euro.ToString());
            var yen = new Money(CurrencyTypes.Yen, dollar.Conversion(CurrencyTypes.Yen));
            Console.WriteLine(yen.ToString());
            Console.ReadKey();


            var euro2 = new Money(CurrencyTypes.Euro, 500);
            Console.WriteLine(euro2.ToString());
            var dollar2 = new Money(CurrencyTypes.Dollar, euro2.Conversion(CurrencyTypes.Dollar));
            Console.WriteLine(dollar2.ToString());
            var yen2 = new Money(CurrencyTypes.Yen, euro2.Conversion(CurrencyTypes.Yen));
            Console.WriteLine(yen2.ToString());
            Console.ReadKey();

            var euro3 = new Money(CurrencyTypes.Euro, 1000);
            var dollar3 = new Money(CurrencyTypes.Dollar, 1000);
            var euro4 = euro3 + dollar3;


            Console.WriteLine(euro3 + " + "  + dollar3 + " = " + euro4);
            Console.ReadKey();


        }