SORU 1
Kullanıcının TextBox a girdiği süre kadar saniye olarak ilerleten ve süre bittiğinde mesaj kutusunda "SÜRENİZ DOLDU" Uyarısını verip sayacı durduran Sıfırla Butonuna Basıldığında TextBox ve süreyi sıfırlayıp timer'ı durduran programı Yazınız...
int sayaç = 0; private void button1_Click(object sender, EventArgs e) //BAŞLAT BUTONU { timer1.Start(); sayaç = Convert.ToInt32(textBox1.Text); label1.Text = sayaç.ToString(); } private void button2_Click(object sender, EventArgs e) //SIFIRLA BUYONU { timer1.Stop(); textBox1.Text = ""; label1.Text = "0"; sayaç = 0; } private void timer1_Tick(object sender, EventArgs e) { sayaç--; label1.Text = sayaç.ToString(); if (sayaç == 0) { timer1.Stop(); MessageBox.Show("SÜRENİZ DOLDU"); } } private void Form1_Load(object sender, EventArgs e) { sayaç = 0; timer1.Interval = 1000; }
SORU 2
ComboBox'ta seçilen aya göre label'eseçilen ayın mevsimini Yazdıran C# Kodunu Yazınız.
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { if (comboBox1.SelectedItem == "aralık" || comboBox1.SelectedItem == "ocak" || comboBox1.SelectedItem == "şubat") { label4.Text = "KIŞ"; } else if (comboBox1.SelectedItem == "mart" || comboBox1.SelectedItem == "nisan" || comboBox1.SelectedItem == "mayıs") { label4.Text = "ilkbahar"; } else if (comboBox1.SelectedItem == "haziran" || comboBox1.SelectedItem == "temmuz" || comboBox1.SelectedItem == "ağustos") { label4.Text = "yaz"; } else { label4.Text = "Sonbahar"; } }
SORU 3
İdeal Kilo Hesaplama
(boy - 100 + (yaş /100))*0.85 Formülü ile hesaplanmaktadır formülü kullanarak boy ve yaş girilen kişinin ideal kilosunu hesaplayan C# Programını Yazınız.
double boy = Convert.ToDouble(textBox2.Text); double yaş = Convert.ToDouble(textBox3.Text); double toplam = 0; toplam = (boy - 100 + (yaş / 100)) * 0.85; label8.Text = toplam.ToString();