예제 #1
0
        public static void Main()
        {
            double height       = 0;
            double width        = 0;
            double depth        = 0;
            double diameter     = 0;
            double heightHole   = 0;
            double widthHole    = 0;
            double diameterHole = 0;

            Console.WriteLine("Snap objects through holes v2.0");
            Console.WriteLine(new string ('-', 31));
            Console.WriteLine("Choose object that you want to push through:");
            Console.WriteLine("\n 1. Parallelepiped" + "\n 2. Ñylinder" + "\n 3. Ball");

            UserChoice       numberObject   = new UserChoice();
            int              option         = numberObject.UserChoiceNumber();
            DifferentObjects selectedObject = new DifferentObjects();
            DifferentHoles   selectedHole   = new DifferentHoles();
            Logic            result         = new Logic();

            if (option == 1)
            {
                selectedObject.Parallelepiped(out height, out width, out depth);
                selectedHole.HoleChoice(out heightHole, out widthHole, out diameterHole);
                result.CompareSquares(height, width, depth, heightHole, widthHole, diameterHole);
            }
            else if (option == 2)
            {
                selectedObject.Ñylinder(out height, out diameter);
                selectedHole.HoleChoice(out heightHole, out widthHole, out diameterHole);
                result.CompareCylinder(height, diameter, heightHole, widthHole, diameterHole);
            }
            else if (option == 3)
            {
                selectedObject.Sphere(out diameter);
                selectedHole.HoleChoice(out heightHole, out widthHole, out diameterHole);
                result.CompareShpere(heightHole, widthHole, diameterHole, diameter);
            }

            Console.ReadKey();
        }
예제 #2
0
        public void HoleChoice(out double heightHole, out double widthHole, out double diameterHole)
        {
            heightHole   = 0;
            widthHole    = 0;
            diameterHole = 0;

            Console.WriteLine("Select the shape of the hole, " +
                              "through which you want to push the object");
            Console.WriteLine("\n 1. Rectangular" + "\n 2. Round");

            UserChoice     numberObject = new UserChoice();
            int            optionHole   = numberObject.UserChoiceHole();
            DifferentHoles holes        = new DifferentHoles();

            if (optionHole == 1)
            {
                holes.Rectangular(out heightHole, out widthHole);
            }
            else if (optionHole == 2)
            {
                holes.Round(out diameterHole);
            }
        }