Visual Studio C# Örnekleri – Araba Park Ücreti Hesaplama
Visual Studio C# Örneklerimize araba park ücreti hesaplama programı ile devam ediyoruz, bir park yerinde otomobil için saat 5, gün 30, kamyon-kamyonet için saat 7, gün 80 şeklinde ücretlendirme yapılması isteniyor, program için ilk olarak aşağıdaki form tasarımını yapıyor ve kodlarımızı yazıyoruz..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | private void button1_Click( object sender, EventArgs e) { int saat = 0, gun = 0,ucret=0; string [] dizi= new string [30]; string [] dizi1 = new string [30]; dizi = comboBox2.Text.Split( ' ' ); gun = Int16.Parse(dizi[0]); dizi1 = comboBox1.Text.Split( ' ' ); saat = Int16.Parse(dizi1[0]); if (radioButton1.Checked) { ucret = gun * 30 + saat * 5; } if (radioButton2.Checked) { ucret = gun * 80 + saat * 7; } label3.Text = ucret.ToString(); } private void Form1_Load( object sender, EventArgs e) { for ( int i = 1; i <= 23; i++) { comboBox1.Items.Add(i+ " Saat" ); for ( int i = 0; i <= 30; i++) { comboBox2.Items.Add(i + " Gün" ); } }
|
0 Comments
EmoticonEmoticon