Beispiel #1
0
        private BmiCalculator()
        {
            _fatLevelEntries = LoadEntries();


            // Таблица заполнена в соответствии с: https://simpledoc.ru/indeks-massy-tela/#start

            var littleAge = new SegmentsList <double, FatLevel>();

            littleAge.Add(0, FatLevel.Underweight);
            littleAge.Add(15.3, FatLevel.Normal);
            littleAge.Add(17, FatLevel.Owerweight);
            littleAge.Add(18.3, FatLevel.FirstGradeObesity);
            littleAge.Add(20.3, FatLevel.SecondGradeObesity);
            littleAge.Add(25, FatLevel.ThirdGradeObesity);
            littleAge.Add(35, FatLevel.FourthGradeObesity);

            var middleAge = new SegmentsList <double, FatLevel>();

            middleAge.Add(0, FatLevel.Underweight);
            middleAge.Add(19.5, FatLevel.Normal);
            middleAge.Add(23, FatLevel.Owerweight);
            middleAge.Add(27.5, FatLevel.FirstGradeObesity);
            middleAge.Add(30, FatLevel.SecondGradeObesity);
            middleAge.Add(35, FatLevel.ThirdGradeObesity);
            middleAge.Add(40, FatLevel.FourthGradeObesity);

            var oldAge = new SegmentsList <double, FatLevel>();

            oldAge.Add(0, FatLevel.Underweight);
            oldAge.Add(20, FatLevel.Normal);
            oldAge.Add(26, FatLevel.Owerweight);
            oldAge.Add(28, FatLevel.FirstGradeObesity);
            oldAge.Add(31, FatLevel.SecondGradeObesity);
            oldAge.Add(36, FatLevel.ThirdGradeObesity);
            oldAge.Add(41, FatLevel.FourthGradeObesity);


            _bmiByAgesList = new SegmentsList <int, SegmentsList <double, FatLevel> >();
            _bmiByAgesList.Add(0, littleAge);
            _bmiByAgesList.Add(18, middleAge);
            _bmiByAgesList.Add(30, oldAge);
        }
Beispiel #2
0
 /// <summary>
 /// Create new instance of <see cref="Circle"/>.
 /// </summary>
 /// <param name="radius">Circle radius.</param>
 public Circle(double radius)
 {
     AssertRadiusIsGreaterThanZero(radius);
     SegmentsList.Add(new CircleContourSegment(radius));
 }