Question
Write a program, using the provided code Lab 4 Program.cpp in Canvas, that calculates the customers grocery bill. It should display a list of items
Write a program, using the provided code Lab 4 Program.cpp in Canvas, that calculates the customers grocery bill. It should display a list of items (veggies, fruits and chips) and asks the customer to select an item. The program should then display a list of available vegetables or fruits of chips and the price for each of them. The customer selects an item and enters the quantity. The program computes and displays the total price. The following is the list of items: V: Veggies F: Fruits C: Chips The following is the list of available veggies: O: Onions ($0.79 per lb) T: Tomatoes ($0.68 per lb) P: Potatoes ($0.82 per lb) The following is the list of available fruits: G: Grapes ($1.9 per lb) A: Apples ($0.98 per lb) B: Bananas ($0.60 per lb) The following is the list of available chips: W: Wavy ($2.28) L: Lays ($2.50) R: Onion Rings ($1.50) Use a switch statement to evaluate the total cost of the customers grocery bill based on the selected item. If invalid input is given, display an error message and terminate the program. Do not use more than one return statement in your program. Sample Run 1: Welcome to the Grocery Store! Enter the item you wish to purchase: V: Veggies F: Fruits C: Chips V Select the vegetable you want to buy: O: Onions ($0.79 per lb) T: Tomatoes ($0.68 per lb) P: Potatoes ($0.82 per lb) T Enter the weight (lb): 5 The total price is $3.4 Sample Run 2: Welcome to the Grocery Store! Enter the item you wish to purchase: V: Veggies F: Fruits C: Chips c Select the chips you want to buy: W: Wavy ($2.28) L: Lays ($2.50) R: Onion Rings ($1.50) l Enter the quantity: 2 The total price is $5
Sample Run 3: Welcome to the Grocery Store! Enter the item you wish to purchase: V: Veggies F: Fruits C: Chips d Invalid choice. Terminating the program. Sample Run 4: Welcome to the Grocery Store! Enter the item you wish to purchase: V: Veggies F: Fruits C: Chips F Select the fruits you want to buy: G: Grapes ($1.9 per lb) A: Apples ($0.98 per lb) B: Bananas ($0.60 per lb) e Invalid choice. Terminating the program.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started