Answer the following questions
1. Given the following structure and variable definitions,
struct customer {
char lastName[ 20 ];
char firstName[ 20 ];
unsigned int customerNumber;
struct {
char phoneNumber[ 11 ];
char address[ 60 ];
char city[ 20 ];
char state[ 3 ];
char zipCode[ 6 ];
} personal;
} customerRecord, *customerPtr;
customerPtr = &customerRecord;
Write an expression that can be used to access the structure members in each of the following parts:
a) Member lastName of structure customerRecord.
b) Member lastName of the structure pointed to by customerPtr.
c) Member firstName of structure customerRecord.
d) Member firstName of the structure pointed to by customerPtr.
e) Member customerNumber of structure customerRecord.
f) Member customerNumber of the structure pointed to by customerPtr.
g) Member phoneNumber of member personal of structure customerRecord.
h) Member phoneNumber of member personal of the structure pointed to by customerPtr.
i) Member address of member personal of structure customerRecord.
j) Member address of member personal of the structure pointed to by customerPtr.
k) Member city of member personal of structure customerRecord.
l) Member city of member personal of the structure pointed to by customerPtr.
m) Member state of member personal of structure customerRecord.
n) Member state of member personal of the structure pointed to by customerPtr.
o) Member zipCode of member personal of structure customerRecord.
p) Member zipCode of member personal of the structure pointed to by customerPtr.
2. Computerization of Health Records:
A health care issue that has been in the news lately is the computerization of health records. This possibility is being approached cautiously because of sensitive privacy and security concerns, among others. Computerizing health records could make it easier for patients to share their health profiles and histories among their various health care professionals. This could improve the quality of health care, help avoid drug conflicts and erroneous drug prescriptions, reduce costs and in emergencies could save lives. In this exercise, youll design a starter HealthProfile structure for a person. The structures members should include pointers to the persons first name, last name, gender, date of birth (a pointer to another structure consisting of separate attributes for the month, day and year of birth), height (in inches), weight (in pounds) and family history (a pointer to another structure for family history). The structure for family history consists of separate attributes (i.e., Boolean variables) to identify whether any of the parents had the following health issues: heart Problem, blood Pressure, & Cancer. Your program should have a function that receives this data and uses it to set the members of a HealthProfile variable. The program also should include functions that calculate and return the users age in years, maximum heart rate and target heart-rate range, and body mass index (BMI).
According to the American Heart Association (AHA), 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 thats 5075% of your maximum heart rate.
The formulas for calculating BMI are: see image.
It should also calculate and display the BMI values chart from below: see image.
The program should prompt for the persons information, create a HealthProfile variable for that person and display the information from that variableincluding the persons first name, last name, gender, date of birth, height, weight and family history then calculate and display:
3. The left-shift operator can be used to pack four character values into a four-byte unsigned int variable. Write a program that inputs four characters from the keyboard and passes them to function packCharacters. To pack four characters into an unsigned int variable, assign the first character to the unsigned int variable, shift the unsigned int variable left by 8 bit positions and combine the unsigned variable with the second character using the bitwise inclusive OR operator. Repeat this process for the third and fourth characters. The program should output the characters in their bit format before and after theyre packed into the unsigned int to prove that the characters are in fact packed correctly in the unsigned int variable.