C# 2012: How to Program
In this part, we instantiate C# object and display records we created in our C# class.
In this exercise, you’ll design a “starter” HealthProfile class for a person.
The class attributes should include the person’s first name, last name, gender, date of birth (consisting of separate attributes for the month, day and year of birth), height (in inches) and weight (in pounds). Your class should have a constructor that receives
this data. For each attribute provide a property with set and get accessors.
The class also should include methods that calculate and return the user’s age in years, maximum heart rate and target-heart-rate range (see Exercise 4.15), and body mass index (BMI; see Exercise 3.31). Write an app that prompts for the person’s information, instantiates an object of class HealthProfile for that person and
displays the information from that object — including the person’s first name, last name, gender, date of birth, height and weight — then calculates and displays the person’s age in years, BMI, maximum heart rate and target-heart-rate range.
It should also display the “BMI values” chart from Exercise 3.31.
3.31 (Body Mass Index Calculator) We introduced the body mass index (BMI) calculator in Exercise 1.29.
The formulas for calculating the BMI are
BMI = ( Weight in Pounds / ( Height in inches x Height in inches ) ) x 703
Create a BMI calculator app that reads the user’s weight in pounds and height in inches then calculates and displays the user’s body mass index. The app should also display the following information from the Department of Health and Human Services
Underweight: less than 18.5
Normal: between 18.5 and 24.9
Overweight: between 25 and 29.9
Obese: 30 or greater
The formula for calculating your maximum heart rate in beats per minute is 220 minus your age in years.
Your target heart rate is a range that is 50–85% of your maximum heart rate.
DOWNLOAD SOURCE FILES: yt-4-16-ComputerizationHealthRecords
Watch Part 1: Creating Class and Properties (C# OOP Concepts)
Watch Part 2: Creating C# Class Methods