예제 #1
0
        public Household GetHousehold(Age age)
        {
            Household household = new Household();

            household.NumberOfAdults = GetRandom(_adults);
            household.NumberOfTeenagers = GetRandom(_minors);
            while (age == Age.Range1 && household.NumberOfTeenagers == 0)
            {
                household.NumberOfTeenagers = GetRandom(_minors);
            }
            household.NumberOfChildren = GetRandom(_minors);
            household.NumberOfBabies = GetRandom(_minors);

            return household;
        }
예제 #2
0
        public Address GetAddress(Age age)
        {
            Address address = new Address();
            address.Country = GetRandom(_countries);

            if (address.Country == "Australia")
            {
                address.Street = GetRandom(_auStreets);
                address.State = GetRandom(_auStates);
                Address rndSuburb = GetRandom(_auSuburbs.Where(a => a.State == address.State));
                address.Suburb = rndSuburb.Suburb;
                address.PostCode = rndSuburb.PostCode;
            }
            else if (address.Country == "England")
            {
                address.Street = GetRandom(_gbStreets);
                address.Suburb = GetRandom(_gbSuburbs);
            }
            else
            {
                address.Street = GetRandom(_nzStreets);
                Address rndSuburb = GetRandom(_nzSuburbs);
                address.Suburb = rndSuburb.Suburb;
                address.PostCode = rndSuburb.PostCode;
            }

            address.Number = _rand.Next(1, 100).ToString();

            double rnd = _rand.NextDouble();
            if ((age == Age.Range1 && rnd < 0.2)
                || (age == Age.Range2 && rnd < 0.3)
                || (age == Age.Range3 && rnd < 0.1)
                || (age == Age.Range4 && rnd < 0.1)
                || (age == Age.Range5 && rnd < 0.1)
                || (age == Age.Range6 && rnd < 0.25)
                )
            {
                Tuple<int, int> value = GetRandom(_unitNumbers);
                address.Unit = _rand.Next(value.Item1, value.Item2).ToString();
            }

            return address;
        }
예제 #3
0
        public AdultMembers GetAdultMembers(Age age, Household household)
        {
            AdultMembers adults = new AdultMembers();
            if (age == Age.Range1)
            {
                adults.Student++;
            }
            else if (age == Age.Range6)
            {
                adults.Retired++;
            }
            while (adults.Total < household.NumberOfAdults)
            {
                AdultOccupations occupation = GetRandom(_occupations);
                if (occupation == AdultOccupations.WorkingFullTime)
                {
                    adults.WorkingFullTime++;
                }
                else if (occupation == AdultOccupations.WorkingPartTime)
                {
                    adults.WorkingPartTime++;
                }
                else if (occupation == AdultOccupations.Retired)
                {
                    adults.Retired++;
                }
                else if (occupation == AdultOccupations.Unemployed)
                {
                    adults.Unemployed++;
                }
                else if (occupation == AdultOccupations.Student)
                {
                    adults.Student++;
                }
            }

            return adults;
        }