예제 #1
0
 public DriversLicense(Rchar[] format, UsState issuingState)
     : this(format)
 {
     IssuingState = issuingState;
 }
예제 #2
0
        /// <summary>
        /// Difference of national avg to race average added to state average.
        /// </summary>
        /// <param name="state"></param>
        /// <param name="race"></param>
        /// <param name="edu"></param>
        /// <returns></returns>
        public static double SolvePercentGradByStateAndRace(UsState state, NorthAmericanRace? race,
            OccidentalEdu edu = OccidentalEdu.HighSchool | OccidentalEdu.Grad)
        {
            AmericanRacePercents p;
            p = edu >= OccidentalEdu.Bachelor ? AmericanUniversity.NatlGradRate() : AmericanHighSchool.NatlGradRate();
            var stateAvg = p.National;
            var natlAvg = p.National;
            if (state?.GetStateData() != null)
            {
                var stateData = state.GetStateData();
                if (stateData.PercentOfGrads != null && stateData.PercentOfGrads.Count > 0)
                {
                    var f = stateData.PercentOfGrads.FirstOrDefault(x => x.Item1 == edu);
                    if (f != null)
                    {
                        stateAvg = Math.Round(f.Item2, 1);
                    }
                }
            }

            var raceNatlAvg = new Dictionary<NorthAmericanRace, double>
            {
                {NorthAmericanRace.AmericanIndian, p.AmericanIndian - natlAvg},
                {NorthAmericanRace.Asian, p.Asian - natlAvg},
                {NorthAmericanRace.Hispanic, p.Hispanic - natlAvg},
                {NorthAmericanRace.Black, p.Black - natlAvg},
                {NorthAmericanRace.White, p.White - natlAvg},
                {NorthAmericanRace.Pacific, p.Pacific - natlAvg},
                {NorthAmericanRace.Mixed, p.Mixed - natlAvg}
            };
            if (race == null || !raceNatlAvg.ContainsKey(race.Value))
                return Math.Round(stateAvg, 1);

            return Math.Round(stateAvg + raceNatlAvg[race.Value], 1);
        }
예제 #3
0
        public static AmericanHighSchool GetAmericanHighSchool(UsState homeState, CityArea hca)
        {
            //get all hs for the state
            var hshs = homeState.GetHighSchools() ??
                       Gov.UsState.GetStateByPostalCode(UsCityStateZip.DF_STATE_ABBREV).GetHighSchools();

            //first try city, then state, last natl
            var hs = hshs.FirstOrDefault(x => x.PostalCode == hca?.AddressData?.PostalCode) ??
                         (hshs.Any() ? hshs[Etx.IntNumber(0, hshs.Length - 1)] : AmericanHighSchool.GetDefaultHs());
            return hs;
        }
예제 #4
0
 public static AmericanUniversity GetAmericanUniversity(UsState homeState)
 {
     //pick a univ
     IUniversity univ = null;
     int pick = 0;
     //79 percent attend home state is a guess
     if (Etx.TryBelowOrAt(79, Etx.Dice.OneHundred) &&
         homeState != null && homeState.GetUniversities().Any())
     {
         //pick a univ from the home state
         var stateUnivs = homeState.GetUniversities();
         if (!stateUnivs.Any())
             return null;
         pick = Etx.IntNumber(0, stateUnivs.Length - 1);
         univ = stateUnivs[pick];
     }
     else
     {
         //pick a university from anywhere in the US
         var allUnivs = TreeData.AmericanUniversityData.SelectNodes("//state");
         if (allUnivs == null)
             return null;
         AmericanUniversity univOut;
         pick = Etx.IntNumber(0, allUnivs.Count - 1);
         var randUnivXml = allUnivs[pick] as XmlElement;
         if (randUnivXml == null || !randUnivXml.HasChildNodes)
             return null;
         pick = Etx.IntNumber(0, randUnivXml.ChildNodes.Count - 1);
         var univXmlNode = randUnivXml.ChildNodes[pick] as XmlElement;
         if (univXmlNode == null)
             return null;
         if (AmericanUniversity.TryParseXml(univXmlNode, out univOut))
         {
             univ = univOut;
         }
     }
     return (AmericanUniversity)univ;
 }
예제 #5
0
 public UsStateData(UsState state)
     : this(state.ToString())
 {
 }