static void Main(string[] args) { Console.WriteLine("The calculator currently only functions in a metric system (kg and cm)."); Console.WriteLine("What is your height? (cm)"); double height = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("What is your current weight? (kg)"); double weight = Convert.ToDouble(Console.ReadLine()); Person person = new Person(height, weight); BMI bmi = new BMI(person); bmi.Calculate_BMI(); Console.WriteLine("Your BMI is {0:F1}. You are {1}.", bmi.BodyMassIndex, bmi.Status); }
private void Calculate_Click(object sender, EventArgs e) { if (Imperial.Checked == true) { double height = double.Parse(HeightBox.Text); double Weight = double.Parse(WeightBox.Text); double BMI; BMI = (Weight * 703) / (height * height); ResultBox.Text = BMI.ToString(); } if (Metric.Checked == true) { double height = double.Parse(HeightBox.Text); double Weight = double.Parse(WeightBox.Text); double BMI; BMI = (Weight) / (height * height); ResultBox.Text = BMI.ToString(); } }