Exemplo n.º 1
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            button1.Enabled = false;
            double x1, y1, r2, r3, h3, r14, r24, h4;

            x1 = Convert.ToDouble(textBox2.Text);
            y1 = Convert.ToDouble(textBox3.Text);

            r2 = Convert.ToDouble(textBox10.Text);

            r3 = Convert.ToDouble(textBox11.Text);
            h3 = Convert.ToDouble(textBox4.Text);

            r14 = Convert.ToDouble(textBox8.Text);
            r24 = Convert.ToDouble(textBox12.Text);
            h4  = Convert.ToDouble(textBox13.Text);

            Point tochka = new Point();

            tochka.pointX  = x1;
            tochka.pointY  = y1;
            textBox1.Text += "Точка" + Environment.NewLine;
            textBox1.Text += "x= " + tochka.pointX + "\t";
            textBox1.Text += "y= " + tochka.pointY + Environment.NewLine;
            textBox1.Text += Environment.NewLine + Environment.NewLine;

            Orbit orbits = new Orbit(r2);

            orbits.radi    = r2;
            textBox1.Text += "Площадь круга = " + string.Format("{0:F3}", orbits.Skrug()) + Environment.NewLine;
            textBox1.Text += Environment.NewLine + Environment.NewLine;

            StraightCone straightCone = new StraightCone(r3, h3);

            straightCone.radi = r3;
            straightCone.Heig = h3;
            textBox1.Text    += "Площадь поверхности конуса = " + string.Format("{0:F3}", straightCone.SCone()) + Environment.NewLine;
            textBox1.Text    += Environment.NewLine + Environment.NewLine;

            Frustum frustum = new Frustum(r14, r24, h4);

            frustum.Heig   = h4;
            frustum.radi1  = r14;
            frustum.radi2  = r24;
            textBox1.Text += "Объем усеченого конуса = " + string.Format("{0:F3}", frustum.VFrustCone()) + Environment.NewLine;
            textBox1.Text += Environment.NewLine + Environment.NewLine;

            Snowman night_King = new Snowman();

            night_King.Bucket.Hei       = Convert.ToDouble(textBox14.Text);
            night_King.Bucket.Rad       = Convert.ToDouble(textBox15.Text);
            night_King.Head.Rad         = Convert.ToDouble(textBox16.Text);
            night_King.Average_body.Rad = Convert.ToDouble(textBox17.Text);
            night_King.Lower_body.Rad   = Convert.ToDouble(textBox18.Text);
            textBox1.Text += "Объем снеговика-ходока = " + string.Format("{0:F3}", night_King.volume()) + Environment.NewLine;
            textBox1.Text += "Площадь поверхности снеговика-ходока = " + string.Format("{0:F3}", night_King.squareFull) + Environment.NewLine;
        }
Exemplo n.º 2
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            button1.Enabled = false;
            double x1, y1, x2, y2, r2, x3, y3, r3, h3, x4, y4, r4, h4;

            x1 = Convert.ToDouble(textBox2.Text);
            y1 = Convert.ToDouble(textBox3.Text);

            x2 = Convert.ToDouble(textBox5.Text);
            y2 = Convert.ToDouble(textBox4.Text);
            r2 = Convert.ToDouble(textBox10.Text);

            x3 = Convert.ToDouble(textBox7.Text);
            y3 = Convert.ToDouble(textBox6.Text);
            r3 = Convert.ToDouble(textBox11.Text);
            //h3 = Convert.ToDouble(textBox9.Text);

            x4 = Convert.ToDouble(textBox9.Text);
            y4 = Convert.ToDouble(textBox8.Text);
            r4 = Convert.ToDouble(textBox12.Text);
            h4 = Convert.ToDouble(textBox13.Text);
            Point tochka = new Point();

            tochka.pointX  = x1;
            tochka.pointY  = y1;
            textBox1.Text += "Точка" + Environment.NewLine;
            textBox1.Text += "x= " + tochka.pointX + "\t";
            textBox1.Text += "y= " + tochka.pointY + Environment.NewLine;
            textBox1.Text += Environment.NewLine + Environment.NewLine;
            textBox1.Text += "Круг" + Environment.NewLine;
            textBox1.Text += "Невозможно создать экземпляр абстрактного класса Circle " + Environment.NewLine;
            textBox1.Text += Environment.NewLine + Environment.NewLine;
            Scope roll = new Scope(x3, y3, r3);

            textBox1.Text += "Цилиндр" + Environment.NewLine;
            textBox1.Text += "x= " + roll.pointX + "\t";
            textBox1.Text += "x= " + roll.pointY + "\t";
            textBox1.Text += "r= " + roll.Rad + "\t";
            textBox1.Text += "Площадь основания цилиндра = " + string.Format("{0:F3}", roll.square()) + Environment.NewLine;
            textBox1.Text += "Объем цилиндра = " + string.Format("{0:F3}", roll.volume()) + Environment.NewLine;
            textBox1.Text += "Площадь поверхности цилиндра = " + string.Format("{0:F3}", roll.squareFull()) + Environment.NewLine;
            textBox1.Text += Environment.NewLine + Environment.NewLine;

            Cone bell = new Cone(x4, y4, r4);

            bell.Hei       = h4;
            textBox1.Text += "Конус" + Environment.NewLine;
            textBox1.Text += "x= " + bell.pointX + "\t";
            textBox1.Text += "x= " + bell.pointY + "\t";
            textBox1.Text += "r= " + bell.Rad + "\t";
            textBox1.Text += "h= " + bell.Hei + Environment.NewLine;
            textBox1.Text += "Площадь основания конуса = " + string.Format("{0:F3}", bell.square()) + Environment.NewLine;
            textBox1.Text += "Объем конуса = " + string.Format("{0:F3}", bell.volume()) + Environment.NewLine;
            textBox1.Text += "Площадь поверхности конуса = " + string.Format("{0:F3}", bell.squareFull()) + Environment.NewLine + Environment.NewLine + Environment.NewLine;
            Snowman night_King = new Snowman();

            night_King.Bucket.Hei       = Convert.ToDouble(textBox14.Text);
            night_King.Bucket.Rad       = Convert.ToDouble(textBox15.Text);
            night_King.Head.Rad         = Convert.ToDouble(textBox16.Text);
            night_King.Average_body.Rad = Convert.ToDouble(textBox17.Text);
            night_King.Lower_body.Rad   = Convert.ToDouble(textBox18.Text);
            textBox1.Text += "Объем снеговика-ходока = " + string.Format("{0:F3}", night_King.volume()) + Environment.NewLine;
            textBox1.Text += "Площадь поверхности снеговика-ходока = " + string.Format("{0:F3}", night_King.squareFull) + Environment.NewLine;
        }