Пример #1
0
        public void ConversionFeet(double value, FeetConvert feetConvert)
        {
            switch (feetConvert)
            {
            case FeetConvert.Centimeters:
                double total = Math.Round((value * 30.48), 2);
                Console.WriteLine(value + " feet is equal to " + total + " " + FeetConvert.Centimeters);
                break;

            case FeetConvert.Inches:
                double total1 = Math.Round((value * 12), 2);
                Console.WriteLine(value + " feet is equal to " + total1 + " " + FeetConvert.Inches);
                break;

            case FeetConvert.Meters:
                double total2 = Math.Round((value * 0.3048), 2);
                Console.WriteLine(value + " feet is equal to " + total2 + " " + FeetConvert.Meters);
                break;

            case FeetConvert.Millimeters:
                double total3 = Math.Round((value * 304.8), 2);
                Console.WriteLine(value + " feet is equal to " + total3 + " " + FeetConvert.Millimeters);
                break;

            case FeetConvert.Yards:
                double total4 = Math.Round((value * 0.33333333333), 2);
                Console.WriteLine(value + " feet is equal to " + total4 + " " + FeetConvert.Yards);
                break;

            default:
                Console.WriteLine("Ya did good!");
                break;
            }
        }
Пример #2
0
        public void ConversionFeet(double value, FeetConvert feetConvert)
        {
            switch (feetConvert)
            {
            case FeetConvert.Centimeters:
                double total = Math.Round((value * 30.48), 2);
                Console.WriteLine(total + "Centimeters");
                break;

            case FeetConvert.Inches:
                double total1 = Math.Round((value * 12), 2);
                Console.WriteLine(total1 + "Inches");
                break;

            case FeetConvert.Meters:
                double total2 = Math.Round((value * 0.3048), 2);
                Console.WriteLine(total2 + "Inches");
                break;

            case FeetConvert.Millimeters:
                double total3 = Math.Round((value * 0.3048), 2);
                Console.WriteLine(total3 + "Inches");
                break;

            case FeetConvert.Yards:
                double total4 = Math.Round((value * 0.33333333333), 2);
                Console.WriteLine(total4 + "Inches");
                break;
            }
        }
        public enum FeetConvert { Centimeters, Inches, Meters, Millimeters, Yards, All };  //All converts all of them; remove All if 1 at a time

        //Method that takes 2 parameters
        public void ConversionFeet(double value, FeetConvert feetConvert)
        {
            switch (feetConvert)
            {
            case FeetConvert.Millimeters:
                double total = value * 304.8;
                Console.WriteLine(total + " millimeters");
                break;

            case FeetConvert.All:                         // All of the conversions, rather than 1 at a time

                break;
            }

            {
                double multiplr = 2;
                double mmm      = 304.8;
                double cm       = 30.48;
                double iii      = 12;
                double m        = 0.3048;
                double yd       = 0.33333333333;
                double total;

                //int cm = (int)UnitOfMeasure.centimeter;
                //if (FeetConvert.Centimeters = 1)

                total = multiplr * cm;
                Console.WriteLine("Centimeters = {0}", total);
                Console.WriteLine();

                //Console.WriteLine(UnitOfMeasure.centimeter, (cm* multiplr));
                //Console.WriteLine((int)UnitofMeasure.centimeter);

                Console.WriteLine(FeetConvert.Centimeters);
                //cm = Convert.ToDouble(Console.ReadLine());

                //multiplr = Convert.ToDouble(Console.ReadLine());

                //total = multiplr * mmm;

                //Console.WriteLine("Total is : " + total);
                //Console.ReadKey();
            }
        }