Question: Write a C++ program that calculates a customers total expense and generates a receipt. Your program should define a struct type (using typedef) called ITEM,
Write a C++ program that calculates a customers total expense and generates a receipt. Your program should define a struct type (using typedef) called ITEM, which consists of three elements: name(e.g. char name[10]), price(e.g. float price), and quantity(e.g. int quantity). Then it needs to create an array of four ITEM structs and initialize the array with the above item information (Each quantity is initialized to zero.). Then it should display a menu and continue to ask the user to buy food until the answer is 'q' . Assume the user enters correct inputs (No input validation is needed.). Your program should be able to print exactly the same as the following sample output. You dont need to consider sales tax. Hints: 1. You may use a char variable to choose an item number or 'q' to exit. 2. Please use the cin and cout objects, rather than the printf and scanf C functions. If you meet a buffered output issue in Xcode, you may try to compile your program with the Terminal console application. 3. You may print the menu using literal strings with cout. You dont need to deal with formatted output in C++ now. 4. You may initialize your array of items in the main function
Please include comments

Welcome to ECE114 Food Market! No Item Name Unit Price 1 I Egg I 0.20 2 I Milk 4.99 2.75 3 Bread I 4 Apple 1.25 (continued on next page) ECE114 Intro to C/C++ Programming Spring 2017 Which item do you want to purchase C' q' to exit 1 How many? 12 Which item do you want to purchase C.q. to exit 4 How many? 7 to exit 3 Which item do you want to purchase C'q' How many? 5 to exit 2 Which item do you want to purchase C q' How many? 2 Which item do you want to purchase C'q' to exit 4 How many? 3 Which item do you want to purchase C'q' to exit 1 How many? Which item do you want to purchase C'q' to exit q Receipt: 18 Egg 2 Milk 5 Bread 10 Apple Total: $39.83 Thank you for shopping
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
