using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ch7_4
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Point point = new Point(7, 11);
            Circle circle = new Circle(22, 8, 3.5);
            Cylinder cylinder = new Cylinder(10, 10, 3.3, 10);
            Shape[] arrayOfshapes = new Shape[3];
            //arrayOfShapes[0] = point Object
            arrayOfshapes[0] = point;
            //arrayOfShapes[1] = circle Object
            arrayOfshapes[1] = circle;
            //arrayOfShapes[0] = cylinder Object
            arrayOfshapes[2] = cylinder;
            label1.Text = point.Name + " : " + point + "\n" +
                circle.Name + " : " + circle + "\n" +
                cylinder.Name + " : " + cylinder + "\n";
            //didplay name, area and volume for any object 
            //in arrayOfShapes polymorphically
            foreach (Shape shape in arrayOfshapes)
            {
                label1.Text += "\n\n" + shape.Name + " : " + shape +
                    "\narea = " + shape.area().ToString("F") +
                    "\nvolume = " + shape.volume().ToString("F");
            }
        }
    }
}
