Example #1
0
        /// <summary>
        /// 取得BMI健康管理報告
        /// </summary>
        /// <param name="human">案例資料</param>
        /// <returns>報告</returns>
        public string GetBMIHealthyCheckReport(Human human)
        {
            var bmi = this.BMICalculatorService.Calculating(human.Weight, human.Tall);

            this.InitBound(human.Gender);

            var report = this.GetConsultantReport(bmi, human.Gender);

            return report;
        }
Example #2
0
        /// <summary>
        /// 執行計算BMI值主程式
        /// </summary>
        public void Run()
        {
            Console.WriteLine("請輸入性別  男(Male), 女(Female)");
            GenderEnum gender;
            Enum.TryParse<GenderEnum>(Console.ReadLine(), out gender);

            Console.WriteLine("請輸入身高(cm)?");
            decimal tall;
            decimal.TryParse(Console.ReadLine(), out tall);

            Console.WriteLine("請輸入體重(kg)?");
            decimal weight;
            decimal.TryParse(Console.ReadLine(), out weight);

            var human1 = new Human { Weight = weight, Tall = tall, Gender = gender };

            var report = this.BMIConsultant.GetBMIHealthyCheckReport(human1);

            Console.WriteLine($"健康評語:{report}");

            Console.Read();
        }