Example #1
0
        private void btnCalculate_Click(object sender, EventArgs e)
        {
            double r = Convert.ToDouble(txtRound.Text);

            if (rbCone.Checked && txtRound.Text != null)
            {
                GeometricFigure cone = new Cone();
                cone.h             = Convert.ToDouble(txtHeight.Text);
                txtFloorSpace.Text = cone.FloorSpace(r).ToString();
                txtVolume.Text     = cone.Volume(r).ToString();
                lblFigure.Text     = cone.Description();
            }
            else if (rbSylinder.Checked)
            {
                Sylinder sylinder = new Sylinder();
                sylinder.h         = Convert.ToDouble(txtHeight.Text);
                txtFloorSpace.Text = sylinder.FloorSpace(r).ToString();
                txtVolume.Text     = sylinder.Volume(r).ToString();
                lblFigure.Text     = sylinder.Description();
            }
            else if (rbSphere.Checked)
            {
                Sphere sphere = new Sphere();
                txtFloorSpace.Text = sphere.FloorSpace(r).ToString();
                txtVolume.Text     = sphere.Volume(r).ToString();
                lblFigure.Text     = sphere.Description();
            }
        }