using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace TSA_Beadandó
{
    /// <summary>
    /// Interaction logic for trapez.xaml
    /// </summary>
    public partial class trapez : Window
    {
        public trapez()
        {
            InitializeComponent();
        }

        private void b_trap_Click(object sender, RoutedEventArgs e)
        {
            double k, t,m,x,y = 0;
            int a = int.Parse(tb_a_trap.Text);
            int b = int.Parse(tb_b_trap.Text);
            int c = int.Parse(tb_c_trap.Text);
            int d = int.Parse(tb_d_trap.Text);
            k = 2 * (a + b);
            x=Math.Pow(b,2);
            y=Math.Pow(((a - c) / 2),2);
            m = Math.Sqrt(Math.Abs(x - y));
            t = ((a+c) * m)/2;
            l_K_trap.Content = k;
            l_T_trap.Content = t;
        }
    }
}
