Beispiel #1
0
        private void printResult(EqualSideTriangle triangle)
        {
            if (triangle.isTriangle())
            {
                LabelIsTriangle.Text = "Is triangle!";
                labelSides.Text      = "Side A: " + formatNumber(triangle.getSideA()) +
                                       "  Side B: " + formatNumber(triangle.getSideB()) +
                                       "  Side C: " + formatNumber(triangle.getSideC());

                LabelSquarePerimeter.Text = "Perimeter: " + triangle.getPerimetr().ToString("0.00") +
                                            "  Square: " + triangle.getSquare().ToString("0.00");
                labelCos.Text = "Cos(AB,BC): " + formatNumber(triangle.getCosABBC()) +
                                "  Cos(BC,AC): " + formatNumber(triangle.getCosBCAC()) +
                                "  Cos(AC,AB): " + formatNumber(triangle.getCosACAB());
                labelEqualTriangle.Text = triangle.isTriangle() ? "Is equal side triangle" : "Is not equal side triangle";
            }
            else
            {
                LabelIsTriangle.Text      = "";
                labelSides.Text           = "";
                LabelSquarePerimeter.Text = "";
                labelCos.Text             = "";
                labelEqualTriangle.Text   = "";
                LabelIsTriangle.Text      = "Is not triangle!";
            }
        }
Beispiel #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            double textBox1 = Double.Parse(numericUpDownX1.Text);
            double textBox2 = Double.Parse(numericUpDownY1.Text);
            double textBox3 = Double.Parse(numericUpDownX2.Text);
            double textBox4 = Double.Parse(numericUpDownY2.Text);
            double textBox5 = Double.Parse(numericUpDownX3.Text);
            double textBox6 = Double.Parse(numericUpDownY3.Text);

            EqualSideTriangle triangle = new EqualSideTriangle(textBox1, textBox2, textBox3, textBox4, textBox5, textBox6);

            printResult(triangle);
        }