Question: // please calculate this 1. Given that an array of int named a has been declared with 12 elements and that the integer variable k

// please calculate this 1. Given that an array of int named a has been declared with 12 elements and that the integer variable k holds a value between 0 and 6. Assign 9 to the element just after a[k].

a[k+ &]=9;

2. ssumethat two parallelarrayshave beendeclaredandinitialized:healthOptionanarrayoftypecharthat contains letter codes for different healthcare options andannualCostanarrayoftypeint. The i-thelementofannualCostindicates the annual cost of the i-thelementofhealthOption. In addition, there is ancharvariable,best2.Write the code necessary toassigntobest2the health option with the lower annual cost, considering only the first two healthcare options. Thus, if thevaluesofhealthOptionare 'B', 'Q', 'W', 'Z' and thevaluesofannualCostare 8430, 9400, 7050, 6400 your code wouldassign'B' tobest2because 8430 isless than9400 and is associated with 'B' in the parallelarray. (We ignore 'W' and 'Z' because we are considering only the first two options.)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!