Esempio n. 1
0
        public static void Main(string[] args)
        {
            Console.Write("Enter first name: ");
            string firstName = Console.ReadLine();

            Console.Write("Enter last name: ");
            string lastName = Console.ReadLine();

            Console.Write("Enter gender: ");
            string gender = Console.ReadLine();

            Console.Write("Enter height in inches: ");
            double height = Convert.ToDouble(Console.ReadLine());

            Console.Write("Enter weight in pounds: ");
            double weight = Convert.ToDouble(Console.ReadLine());

            Console.Write("Enter year of birth: ");
            int birthYear = Convert.ToInt32(Console.ReadLine());

            Console.Write("Enter current year: ");
            int currentYear = Convert.ToInt32(Console.ReadLine());

            // create a HealthProfile object for a person based on the user input
            HealthProfile person =
                new HealthProfile(firstName, lastName, gender, height,
                                  weight, birthYear, currentYear);

            // display user's health profile
            person.DisplayHealthProfile();
        } // end Main
Esempio n. 2
0
        static void Main(string[] args)
        {
            HealthProfile myProfile = new HealthProfile();

            Console.WriteLine("Name: {0}, {1}" +
                              "\nGender: {2}" +
                              "\nBMI: {3}" +
                              "\nMaximum heart rate: {4}",
                              myProfile.LastName, myProfile.FirstName, myProfile.Gender, myProfile.GetBmi(), myProfile.MaxRate());
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            int    weight, height, doBMonth, doBDay, doBYear, age;
            int    localCurrentYear;
            string patientLast, patientFirst;
            char   patientGender;
            double maxHeartRate, maxTargHR, minTargHR, patientBMI;

            localCurrentYear = DateTime.Now.Year;

            Console.WriteLine("Enter your first name and last name in first/last order: ");
            patientFirst = Console.ReadLine();
            patientLast  = Console.ReadLine();

            Console.WriteLine("Enter your weight in pounds: ");
            weight = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Enter your height in inches: ");
            height = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Enter the day of your day of the month of birth, the month, and the year, in the listed order:");
            Console.WriteLine("Day of birth: "); doBDay = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Month of birth as an integer: "); doBMonth = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Year of birth: "); doBYear = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Enter the first character of your gender (male/female): "); patientGender = Convert.ToChar(Console.Read());

            HealthProfile randomMemberHealthProfile = new HealthProfile(weight, height, doBMonth, doBDay, doBYear, patientLast, patientFirst, patientGender);

            //perform heart rate methods on random member profile
            age          = randomMemberHealthProfile.CalculateAge(localCurrentYear, doBYear);
            maxHeartRate = randomMemberHealthProfile.CalculateMaxumumHearRate(age);
            maxTargHR    = randomMemberHealthProfile.CalculateUpperTargetHeartRateRangeBound(maxHeartRate);
            minTargHR    = randomMemberHealthProfile.CalculateLowerTargetHeartRateRangeBound(maxHeartRate);
            patientBMI   = randomMemberHealthProfile.CalculateBMI(height, weight);


            Console.WriteLine("Be prepared for a deluge of personal data!"); Console.ReadKey();
            Console.WriteLine("Your age is: {0}", age); Console.WriteLine("Your first and last name are: {0} {1}", patientFirst, patientLast); Console.ReadKey();
            Console.WriteLine("Your Date of Birth is: {0}/{1}/{2}", doBMonth, doBDay, doBYear); Console.ReadKey();
            Console.WriteLine("Your gender is: {0}", patientGender); Console.ReadKey(); Console.WriteLine("Press another key to clear the screen..."); Console.ReadKey();
            Console.Clear();
            Console.WriteLine("Your recommended Maximum heart rate is: {0}", maxHeartRate); Console.ReadKey();
            Console.WriteLine("Your recommended target heart rate range is from {0} to {1}", minTargHR, maxHeartRate); Console.ReadKey();
            Console.WriteLine("Your BMI is: {0}", patientBMI); Console.ReadKey();
        } //end main method
Esempio n. 4
0
        static void Main(string[] args)
        {
            HealthProfile healthProfile = new HealthProfile(null, null, null, null, 0, 0, 0, 0, 0);

            Console.WriteLine("Enter First Name:");
            healthProfile.FirstName = Convert.ToString(Console.ReadLine());
            Console.WriteLine("Enter Last Name:");
            healthProfile.LastName = Convert.ToString(Console.ReadLine());
            Console.WriteLine("Enter Gender:");
            healthProfile.Gender = Convert.ToString(Console.ReadLine());
            Console.WriteLine("Enter Month of Birth:");
            healthProfile.MonthOfBirth = Convert.ToString(Console.ReadLine());
            Console.WriteLine("Enter day of birth:");
            healthProfile.DayOfBirth = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Enter year of birth:");
            healthProfile.YearOfBirth = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Enter Height in inches:");
            healthProfile.HeightInInches = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Enter weight in pounds:");
            healthProfile.WeightInPounds = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Enter Current Year:");
            healthProfile.CurrentYear = Convert.ToInt32(Console.ReadLine());


            healthProfile.DisplayFirstName();
            healthProfile.DisplayLastName();
            healthProfile.DisplayGender();
            healthProfile.DisplayMonthOfBirth();
            healthProfile.DisplayDayOfBirth();
            healthProfile.DisplayYearOfBirth();
            healthProfile.DisplayHeightInInches();
            healthProfile.DisplayWeightInPounds();
            healthProfile.DisplayCurrentYear();
            healthProfile.DisplayAge();
            healthProfile.DisplayMaxHeartRate();
            healthProfile.DisplayTargetHeartRate();
            healthProfile.DisplayBodyMassIndex();
            healthProfile.DisplayBMIOutput();
            healthProfile.DisplayBMIChart();

            Console.ReadKey();
        }