コード例 #1
0
ファイル: BMR.cs プロジェクト: dream2216/ProjectSE_CNPM
        private void button1_Click(object sender, EventArgs e)
        {
            ;
            try
            {
                double W = double.Parse(txtweight.Text) * 10;
                double H = double.Parse(txtheight.Text) * 6.25;
                double A = double.Parse(txtAge.Text) * 5;
                double BMR;


                if (checkmale.CheckState == CheckState.Checked)
                {
                    BMR = W + H - A + 5;
                }
                else
                {
                    BMR = W + H - A - 161;
                }

                lblresult.Text = "BMR = '" + BMR.ToString() + "' Calories/day";
            }
            catch
            {
                if (txtAge.Text == "")
                {
                    lblA.Text = "**";
                }
                if (txtheight.Text == "")
                {
                    lblH.Text = "**";
                }
                if (txtweight.Text == "")
                {
                    lblW.Text = "**";
                }
                if (checkmale.CheckState == CheckState.Unchecked && checkfemale.CheckState == CheckState.Unchecked)
                {
                    lblG.Text = "**";
                }
                MessageBox.Show("Registration failed, please check the information again ");
            }
        }
コード例 #2
0
ファイル: Index.cs プロジェクト: dream2216/ProjectSE_CNPM
        private void btn_bmr_Click(object sender, EventArgs e)
        {
            BMR bmr = new BMR();

            bmr.Show();
        }