コード例 #1
0
        public void Men1_FromTables()
        {
            decimal bodyWeight   = 100;
            decimal liftedWeight = 340;

            Assert.AreEqual(206.924, WilksFormula.CalculateForMenUsingTables(bodyWeight, liftedWeight));
        }
コード例 #2
0
        public void Men2_FromTables()
        {
            decimal bodyWeight   = 76.5m;
            decimal liftedWeight = 245.5m;

            Assert.AreEqual(172.56195, WilksFormula.CalculateForMenUsingTables(bodyWeight, liftedWeight));
        }
コード例 #3
0
 decimal calculateWilks(Customer customer, decimal bodyWeight, decimal exerciseWeight)
 {
     if (bodyWeight <= 0)
     {
         return(0);
     }
     if (customer.Gender == Gender.Male)
     {
         return(WilksFormula.CalculateForMenUsingTables(bodyWeight, exerciseWeight));
     }
     if (customer.Gender == Gender.Female)
     {
         return(WilksFormula.CalculateForWomenUsingTables(bodyWeight, exerciseWeight));
     }
     throw new ArgumentException("Customer without gender!");
 }
コード例 #4
0
        private void btnCalculate_Click(object sender, RoutedEventArgs e)
        {
            var bodyKgWeight  = ((double?)BodyWeight).ToSaveWeight();
            var totalKgWeight = ((double?)TotalWeight).ToSaveWeight();

            if (IsMale)
            {
                var result = WilksFormula.CalculateForMenUsingTables(bodyKgWeight, totalKgWeight);
                Wilks = result.ToString("#.####");
            }
            else
            {
                var result = WilksFormula.CalculateForWomenUsingTables(bodyKgWeight, totalKgWeight);
                Wilks = result.ToString("#.####");
            }
        }