using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
if (radioButton1.Checked)
{
int m = Convert.ToInt32(textBox1.Text);
int n = Convert.ToInt32(textBox2.Text);
Class1 hesapla = new Class1();
listBox1.Items.Add("Alan=" + hesapla.ucgenalan(m, n));
}
if (radioButton2.Checked)
{
int m = Convert.ToInt32(textBox3.Text);
Class1 hesapla = new Class1();
listBox1.Items.Add("Alan=" + hesapla.karealan(m));
}
if (radioButton3.Checked)
{
int m = Convert.ToInt32(textBox4.Text);
int n = Convert.ToInt32(textBox5.Text);
int j = Convert.ToInt32(textBox6.Text);
Class1 hesapla = new Class1();
listBox1.Items.Add("Alan=" + hesapla.yamukalan(m, n, j));
}
}
}
}
CLASSİN İÇİ
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WindowsFormsApplication2
{
class Class1
{
public int ucgenalan(int a, int b)
{
int sonuc = (a * b) / 2;
return sonuc;
}
public int karealan(int a)
{
return a * a;
}
public int yamukalan(int a, int b,int c)
{
int sonuc = ((a + b) *c)/2;
return sonuc;
}
}
}
Hiç yorum yok:
Yorum Gönder