18 Temmuz 2008 Cuma

C# Sınav Not Matik


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 SinavNotMatik
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
}
bool IsNumeric(string text)
{
try
{
int sayi = Convert.ToInt32(text);
return true;
}
catch
{
return false;
}
}
private void btnHespamla_Click(object sender, EventArgs e)
{
if (IsNumeric(txtSayi1.Text) && IsNumeric(txtSayi2.Text))
{
double Sayi1 = Convert.ToDouble(txtSayi1.Text);
double Sayi2 = Convert.ToDouble(txtSayi2.Text);
if (Sayi1 > 100 Sayi2 > 100)
{
MessageBox.Show("Lütfen 0-100 arası bir değer giriniz!");
}
else
{
double Sonuc = Sayi1 * 0.3 + Sayi2 * 0.7;

ListViewItem notlar = new ListViewItem();
if (listView1.Items.Count > 9)
return;
notlar.Text = Sayi1.ToString();
listView1.Items.Add(notlar);
notlar.SubItems.Add(Sayi2.ToString());
if (Sonuc <= 45)
{
notlar.SubItems.Add("Kaldı"); notlar.SubItems.Add("FF");
lblSonuc.Text = "Kaldı";
}
else if (Sonuc > 45 && Sonuc < text = "Geçti"> 55 && Sonuc < text = "Geçti"> 65 && Sonuc < text = "Geçti"> 75 && Sonuc < text = "Geçti"> 85 && Sonuc < 100)
{
notlar.SubItems.Add("Geçti");
notlar.SubItems.Add("AA");
lblSonuc.Text = "Geçti";
}
}
}
}
private void btnTemizle_Click(object sender, EventArgs e)
{
listView1.Items.Clear();
txtSayi1.Clear();
txtSayi2.Clear();
lblSonuc.Text = "DURUM";
}
private void btnKapat_Click(object sender, EventArgs e)
{
this.Close();
}
}
}

Hiç yorum yok: