You are on page 1of 3

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 myproject_C
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)


{
double phy, chem, BIO, TOTAL, AVARAGE;
string grade;

phy = double.Parse(textBox1.Text);
chem = double.Parse(textBox2.Text);
BIO = double.Parse(textBox3.Text);

TOTAL = phy + chem + BIO;


AVARAGE = TOTAL / 3;

textBox4.Text = TOTAL.ToString();
textBox5.Text = AVARAGE.ToString();

if (AVARAGE >= 95 )
{

txtGrade.Text = "+A";

else if (AVARAGE >= 90 )


{
txtGrade.Text = "A";

}
else if (AVARAGE >= 85)
{

txtGrade.Text = "-A";

else if (AVARAGE >= 80)


{

txtGrade.Text = "+B";
}
else if (AVARAGE >= 75)
{

txtGrade.Text = "B";
}

else if (AVARAGE >= 70)


{

txtGrade.Text = "-B";

else if (AVARAGE >= 60 )


{

txtGrade.Text = "+C";
}

else if (AVARAGE >= 65 )


{

txtGrade.Text = "C";

else if (AVARAGE >= 55 )


{

txtGrade.Text = "-C";

else if (AVARAGE >= 50)


{

txtGrade.Text = "+D";
}

else if (AVARAGE >= 45 )


{

txtGrade.Text = "D";
}
else if (AVARAGE >= 40)
{

txtGrade.Text = "-D";
}
else
{
MessageBox.Show("you
failed !" ,"messege",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
}
}

void clearDat()
{
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
textBox4.Clear();
textBox5.Clear();
txtGrade.Clear();
}
private void button2_Click(object sender, EventArgs e)
{
// exits the application
Application.Exit();
}

private void button3_Click(object sender, EventArgs e)


{
clearDat();
}
}
}

You might also like