Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.TextLength == 0)
            {
                MessageBox.Show("Some textboxes are empty! Try again.");
                return;
            }

            double parsedValue;

            if (!double.TryParse(textBox1.Text, out parsedValue))
            {
                MessageBox.Show("This is double only fields! Try again");
                return;
            }

            double z = double.Parse(this.textBox1.Text);

            if (z > 65 || z < 0)
            {
                MessageBox.Show("Please enter value from 0 to 65");
                return;
            }

            int    lowestH     = 0;
            int    highestH    = 100;
            double real_result = 25000000;

            this.listBox1.Items.Clear();
            SingleCount singleCount = new SingleCount(function,
                                                      real_result, AreaType.Rectangle, z, lowestH, highestH);
            double n_rect = singleCount.Zad2();

            this.listBox1.Items.Add($"Metoda prostokatna: {n_rect}");

            singleCount.AreaType = AreaType.Trapezoid;
            double n_trap = singleCount.Zad2();

            this.listBox1.Items.Add($"Metoda trapezowa: {n_trap}");
        }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.TextLength == 0)
            {
                MessageBox.Show("Some textboxes are empty! Try again.");
                return;
            }

            double parsedValue;

            if (!double.TryParse(textBox1.Text, out parsedValue))
            {
                MessageBox.Show("This is double only fields! Try again");
                return;
            }
            double z = double.Parse(this.textBox1.Text);

            if (z < 0 || z > 100)
            {
                MessageBox.Show("Please enter value z from 0 to 100");
                return;
            }
            int    lowestH     = 0;
            double real_result = 1;

            this.listBox1.Items.Clear();
            SingleCount singleCount = new SingleCount(Math.Cos, real_result, AreaType.Rectangle, z, 0, (int)Math.PI / 2);
            double      listRect    = singleCount.Zad2();

            this.listBox1.Items.Add($"Metoda prostokatna: {listRect}");

            singleCount.AreaType = AreaType.Trapezoid;
            double listTrap = singleCount.Zad2();

            this.listBox1.Items.Add($"Metoda trapezowa: {listTrap}");
        }