Question: this is c++ programming question QUESTION 2 [16 Marks] Given the declaration and initialization of some parallel arrays as in the following code segment: string
this is c++ programming question
![this is c++ programming question QUESTION 2 [16 Marks] Given the](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f45f2c96164_17966f45f2c00a9a.jpg)
QUESTION 2 [16 Marks] Given the declaration and initialization of some parallel arrays as in the following code segment: string patients[] = { "Wendy", "Kumar", "Ros", "Mael"}; int age[] = {25, 43, 32, 54}; double averageSugarLevel[4]; Based on the concept of arrays and using loops, answer the following questions: (a) Define a two-dimensional array named sugarLevel which has large enough space to hold the data in the following table. Initialize the array with values from the table. (2 marks) 4.5 6.2 5.1 7.5 5.7 7.1 6.3 8.5 6.8 7.3 8.0 7.3 (b) Write a code segment that prints the patient names along with their ages. The output should be as follows: (3 marks) Age of Patients 25 Wendy Kumar 43 Ros 32 Mael 54 (c) Write a code segment that produces the following output from the array named sugarLevel that you defined in (a). (4 marks) Name Breakfast 4.5 Lunch 5.7 Dinner 6.8 Wendy Kumar 6.2 7.1 7.3 Rose 5.1 6.3 8.0 Mael 7.5 8.5 7.3 (d) Write a code segment to calculate the average sugar level of the patient. The code also store the average sugar level value in the array averageSugarLevel and print the list of the patients' average sugar level value as follows. (7 marks) Sugar Level of Patients 25 Wendy Kumar Ros Mael 43 32 54
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
