Ejemplo n.º 1
0
        private UserAnalysisModel Analyze(IList <UserModel> users)
        {
            UserAnalysisModel model = new UserAnalysisModel();

            var femalePercentage = Calculators.PercentageFemale(users);
            var malePercentage   = 1 - femalePercentage;

            model.Gender = (femalePercentage, malePercentage);

            var firstNameLeftPercentage  = Calculators.PercentageFirstNameMidpoint(users);
            var firstNameRightPercentage = 1 - firstNameLeftPercentage;

            model.FirstName = (firstNameLeftPercentage, firstNameRightPercentage);

            var lastNameLeftPercentage  = Calculators.PercentageLastNameMidpoint(users);
            var lastNameRightPercentage = 1 - lastNameLeftPercentage;

            model.LastName = (lastNameLeftPercentage, lastNameRightPercentage);

            model.StatePercentages       = Calculators.PercentagePeopleInState(users);
            model.FemaleStatePercentages = Calculators.PercentageFemalesInState(users);
            model.MaleStatePercentages   = Calculators.PercentageMalesInState(users);
            model.AgeRangePercentages    = Calculators.PercentageAgeRanges(users);

            model.StateAverageAge = Calculators.StateAverageAge(users);

            return(model);
        }