Son Yazılar

C# Vize Final Not Ortalaması Hesaplama

C# Vize Final Not Ortalaması Hesaplama




     C# Form uygulamasında Üniversite Sınavları olan Vize ve Final sınavlarının Üniversite Not hesaplama sistemine Göre Vize ve Final sınavlarının etki oranına göre not hesaplaya bileceğimiz bir masaüstü programını anlatmaya çalışacağız. Visual Studio 2017 programında Windows Form kısmında 1 Simge, 5 Label, 5 Textbox ve 2 Button ile form tasarımını tamamladıktan sonra Kod kısmına gelerek button click olayında çalışmak üzere textbox kontrolü için if else kullanarak 4 tane double sayısı ile önce Vize notunu sonra etki oranını ve Final notunu ve etki oranını girilmesini sağlayarak not hesaplama işlemimizi tamamlayacağız. 

    Uygulamada özellik olarak textbox kontrolü ve Enter tuşuna basıldığında diğer textboxa geçerek son textboxta butonu çalıştırarak işlem yapılacak ve bir de textboxları temizleme butonu olacak.


C# Vize Final Not Hesaplama Tasarım




C# Uygulama Kodu

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;


namespace Not_Hesaplama

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }


        private void btnNoh_Click(object sender, EventArgs e)

        {

            if (txtBoxVn.Text == "")

            {

                MessageBox.Show("Vize Notunu Girin!", "Not Hesaplama", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

                txtBoxVn.Focus();

            }

                else if (txtBoxVo.Text == "")

                {

                    MessageBox.Show("Vize Oranını Girin!", "Not Hesaplama", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

                    txtBoxVo.Focus();

                }

                else if (txtBoxFn.Text == "")

                {

                    MessageBox.Show("Final Notunu Girin!", "Not Hesaplama", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

                    txtBoxFn.Focus();

                }

                else if (txtBoxFo.Text == "")

                {

                    MessageBox.Show("Final Oranını Girin!", "Not Hesaplama", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

                    txtBoxFo.Focus();

                }


            

            else {

                double vn, vo, fn, fo, ort;

                vn = Convert.ToDouble(txtBoxVn.Text);

                vo = Convert.ToDouble(txtBoxVo.Text);

                fn = Convert.ToDouble(txtBoxFn.Text);

                fo = Convert.ToDouble(txtBoxFo.Text);

                ort = ((vn * vo) / 100) + ((fn * fo) / 100);

                txtBoxNo.Text = ort.ToString();

            }

        }


        private void btntmz_Click(object sender, EventArgs e)

        {

            txtBoxFn.Text = "";

            txtBoxFo.Text = "";

            txtBoxNo.Text = "";

            txtBoxVn.Text = "";

            txtBoxVo.Text = "";

            txtBoxVn.Focus();

        }


        private void txtBoxVn_KeyDown(object sender, KeyEventArgs e)

        {

            if (e.KeyCode == Keys.Enter)

            {

                txtBoxVo.Focus();

            }

        }


        private void txtBoxVo_KeyDown(object sender, KeyEventArgs e)

        {

            if (e.KeyCode == Keys.Enter)

            {

                txtBoxFn.Focus();

            }

        }


        private void txtBoxFn_KeyDown(object sender, KeyEventArgs e)

        {

            if (e.KeyCode == Keys.Enter)

            {

                txtBoxFo.Focus();

            }

        }


        private void txtBoxFo_KeyDown(object sender, KeyEventArgs e)

        {

            if (e.KeyCode == Keys.Enter)

            {

                btnNoh.PerformClick();

            }

        }

    }

}

Yorum Yayınla

Yazı Hakkındaki Düşünceleriniz...

Daha yeni Daha eski