An array meals contains five elements corresponding to the meal codes 0 through 4 in Lab 6.2. For example, element meals[ 1 ] contains the number of "Chicken-based adult" meals requested, meals[ 4 ] contains the number of "Burger child" meals, and so on. Element meals[ 0 ] contains the number of requests in which none of the conditions for a particular meal type was met.
Write code to store in the double cost the cost to the airline of providing the meals, where the cost for a meal of each type is specified in the table below. The number of meals in meals[ 0 ] should be split equally between "Chicken-based adult" and "Beef-based adult". If this number is not an even number, then the number allocated to "Chicken-based adult" should be one more than the number allocated to "Beef-based adult".
Meal Code Meal Cost
1 $1.75
2 $2.08
3 $2.14
4 $0.98
int[] meals = { };
double cost;