示例#1
0
 //CONSTRUCTOR
 public Client(string name, double height, double weight, NutritionClinic clinic)
 {
     Name              = name;
     Height            = Math.Round(height, 2);
     Weight            = Math.Round(weight, 1);
     MyClinic          = clinic;
     PersonalDietitian = clinic.Dietitian;
     PersonalTrainer   = clinic.PersonalTrainer;
 }
        public static Client GenerateRandomClient(NutritionClinic clinic)
        {
            Random r = new Random();
            Client randomClient;

            do
            {
                var randomHeight = Math.Round((r.Next(140, 190) / 100.0), 2);
                var randomWeight = r.Next(200, 1000) / 10;

                randomClient = new Client(GenerateRandomName(), randomHeight, randomWeight, clinic);
            } while (randomClient.BMI < 12 || (randomClient.BMI > 18.5 && randomClient.BMI < 25));

            return(randomClient);
        }