Beispiel #1
0
        public static Chart getChart(String type)
        {
            Chart chart = null;

            try
            {
                if (type.Equals("triangel"))
                {
                    chart = new Triangel();
                }
                else if (type.Equals("circle"))
                {
                    chart = new Circle();
                }
                else if (type.Equals("square"))
                {
                    chart = new Square();
                }
                else if (type.Equals("rectangel"))
                {
                    chart = new Rectangel();
                }
            }
            catch
            {
                Console.WriteLine("Error Input!");
            };
            return(chart);
        }
Beispiel #2
0
        public static Shape GetShape(string type)
        {
            Shape shape = null;

            try
            {
                if (type.Equals("Triangel"))
                {
                    shape = new Triangle();
                }
                else if (type.Equals("Square"))
                {
                    shape = new Square();
                }
                else if (type.Equals("Circle"))
                {
                    shape = new Circle();
                }
                else if (type.Equals("Rectangel"))
                {
                    shape = new Rectangel();
                }
            }
            catch
            {
                Console.WriteLine("Error Iuput!");
            };
            return(shape);
        }