Question: Q2. 19 Marks] Study the mainD function carefully, and then write the following functions Total Cos a. Parameters: i int array quantity W double array
Q2. 19 Marks] Study the mainD function carefully, and then write the following functions Total Cos a. Parameters: i int array quantity W double array price int size b. Each item in the quantity array will have the quantity of an item, and the same tem in the price array will have the price of that item. The function should print both arrays side-by-side as shown in the sample output and Etum the total cost Of all the items. For example, 5atnjol " 5. and pricel0-2. then the total cost for that item is 10. 2) Print table a. Paramaters L int array quontity W. double array price int size The function prints the total price of each value in quantity anray in a tubular format see the output sample ) Max price a. Parameters: i double array price int site the function returns the value and the index of maximum value. 22.5 otal cost 120 e maximun price is 12.5 he index of maimon price is 3 Page 8 of 11 int main 0 ( double max nt Imax nt gfl-12, 3,4, 5 double pll-12.5,7.5,125, 8.5 double cost Total Costiq. p. 4 Print tablele.p4): Max_pricelp,4, max, Imax): coutsc The maximum price isec maxccendi coutec The index of maimum price is "edmaxecend return 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
