예제 #1
0
 public Person(int _personHight, int _personWeight, Gender _personGende)
 {
     PersonHigh   = _personHight;
     PersonWeight = _personWeight;
     PersonGende  = _personGende;
     PersonBMI    = BMIHelper.GetBMI(PersonHigh, PersonWeight);
 }
예제 #2
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());
        }
예제 #3
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);
        }
 public void Init()
 {
     _Sut = new BMIHelper();
 }