Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace HOA4_12WAL11FresnidoFarah
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void label1_Click(object sender, EventArgs e)
- {
- }
- private void button1_Click(object sender, EventArgs e)
- {
- string weight1 = textBox1.Text;
- string height1 = textBox2.Text;
- if ((textBox1.Text == "" || textBox2.Text == "") || (textBox1.Text == "" && textBox2.Text == ""))
- {
- MessageBox.Show("Error: Don't leave anything blank.");
- }
- else if (textBox1.Text != "" && textBox2.Text != "")
- {
- double weight = double.Parse(textBox1.Text);
- double height = double.Parse(textBox2.Text);
- double BMI = (weight * 0.45) / ((height * 0.025) * (height * 0.025));
- label3.Text = "BMI: " + BMI;
- textBox1.Text = "";
- textBox2.Text = "";
- }
- }
- private void button2_Click(object sender, EventArgs e)
- {
- string start1 = textBox3.Text;
- string end1 = textBox4.Text;
- if ((textBox3.Text == "" || textBox4.Text == "") || (textBox3.Text == "" && textBox4.Text == ""))
- {
- MessageBox.Show("Error: Don't leave anything blank.");
- }
- else if (textBox3.Text != "" && textBox4.Text != "")
- {
- double start = double.Parse(textBox3.Text);
- double end = double.Parse(textBox4.Text);
- if (end < start)
- {
- MessageBox.Show("Error: Starting value has to be less than the ending value.");
- }
- else if (end > start)
- {
- double n = end - start + 1;
- double sum = n * ((end + start) / 2);
- label6.Text = "The sum is " + sum;
- textBox3.Text = "";
- textBox4.Text = "";
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement