예제 #1
0
파일: Program.cs 프로젝트: messboy/BMIDemo
        static void Main(string[] args)
        {
            // 提供人員資訊
            var member = new People()
            {
                Sex = "Man", Height = 1.7, Weight = 75
            };

            // 傳給BMIHelper 產生計算物件
            Calculator calculator = BMIHelper.GetCalculator(member);

            // 回傳結果
            Console.WriteLine(calculator.GetResult());
        }
예제 #2
0
파일: Program.cs 프로젝트: messboy/BMIDemo
        static void Main(string[] args)
        {
            // 提供人員資訊 --> 1. 調整型別enum
            var member = new People()
            {
                Sex = Sex.Woman, Height = 1.7, Weight = 95
            };

            // 傳給BMIHelper 產生計算物件
            Calculator calculator = BMIHelper.GetCalculator(member);

            // 回傳結果
            Console.WriteLine(calculator.Result);
        }