I need some advice with implementing a second array in my program. What I have been asked to do is: Ask the customer to select products and quantities and save the provided details in arrays then Read from the arrays to print the order summary; that is, the products, quantities, and the total price for each product Calculate and print the total price for the order.I think I have implemented an array correctly for the quantities, but I can't seem to figure out a way to implement one for the products. I have tried changing my switch case statement around to implement an array for the products with no luck, so i reverted back to my last working program to start over. Not sure where to go from here. Any advice as to how I can go about doing this and or suggestions where I should start would be greatly appreciated. Thanks for any help in advance. My code below is my last working program I reverted back to.
Line 68-95: What is the point of your Customer class? You don't use it.
Line 8: a[3] is a poor name for an array that contains quantities. qty[3] would be a better choice.
Not clear from what you posted, what the prices of your various fruits are. I would suggest you create an array for prices.
constdouble prices[3] = { 0.75, 0.50, 1.0 };
Lines 13-56: What happens if the user selects the same choice on a subsequent pass through the loop. You reset the quantity. Wouldn't it be better to add to the existing quantity?
Lines 60-62: You're assuming the price is the same as the quantity. Unlikely. You can calculate costs inline, or you can create an array for costs.