Ejemplo n.º 1
0
        static void Manu(double height, double weight, string gender)
        {
            int          age = 0, limit = 100, error = 6, agelimit = 150, error5 = 4, menuChoice;
            double       fat = 0, BMI, fatMass = 0, leanBM = 0, BMR = 0, DCR = 0, fatPer = 0;
            const double HUNDRED = 100;

            menuChoice = PrintMenu();

            while (menuChoice != 4)  // in the case 4 is the exit option
            {
                // process choice

                switch (menuChoice)
                {
                case 1:
                    Console.Clear();
                    BMI = BMIClass.BodyMassIndex(height, weight); // call appropriate method(s)
                    Console.WriteLine("BMI Result is {0:0.0}%", BMI);
                    BMIClass.BMIcategories(BMI);                  // call appropriate method(s)
                    Console.ReadKey();
                    break;

                case 2:
                    Console.Clear();
                    Console.Write("Enter Yours fat level(%) :");
                    fat     = TryInt.Try(limit, error);
                    fatPer  = fat / HUNDRED;
                    fatMass = FatClass.FatMass(weight, fatPer);    // call appropriate method(s)
                    leanBM  = FatClass.LeanBodyMass(fatMass, weight);
                    Console.WriteLine("Your Fat Mass value is {0} lb", fatMass);
                    Console.WriteLine("Your Lean Body Mass value is {0} lb", leanBM);

                    Console.ReadKey();
                    break;

                case 3:
                    Console.Clear();
                    Console.Write("Enter Your age:");

                    age = TryInt.Try(agelimit, error5);
                    BMR = Active.BasalMetabolicRate(weight, height, age, gender);
                    DCR = Active.ActivityLevel(BMR);
                    Console.WriteLine("Your BasalMetabolicRate is : {0}", BMR);
                    Console.WriteLine("Your Daily Calorific Requirement is :{0}", DCR);
                    Console.ReadKey();
                    break;

                default:      // something other than 1,2,3,4
                    Console.WriteLine("Invalid menu choice");
                    Console.ReadKey();
                    break;
                }//end switch

                menuChoice = PrintMenu();    //call menu again
            } // end while
        }
Ejemplo n.º 2
0
 static long PassRef(FatClass v)
 {
     return(v.M00 + v.M10 + 1);
 }