Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Points will be given to whomever follows the instructions EXACTLY. Do not use cl

ID: 3532509 • Letter: P

Question

Points will be given to whomever follows the instructions EXACTLY. Do not use classes, vectors, or headers. I am giving the max amount of points for this. Color coded to make it easier to read!




Purpose: Demonstrate the ability to handle arrays, structures, file i/o, and use pointers to
accomplish dynamic memory allocation.
Write a C++ program to do the following:


Given an input file (named products.txt) with a list of products, which is
partially displayed below:


4011 BANANAS 1 0.49 123.2
4383 MINNEOLAS 1 0.79 187.3
3144 TANGERINES 1 1.19 135.5
4028 STRAWBERRIES_PINT 0 0.99 104
4252 STRAWBERRIES_HALF_CASE 0 3.99 53
4249 STRAWBERRIES_FULL_CASE 0 7.49 67.


A) Write a program to perform grocery check-out procedure for a simple store. Use a dynamic
array of structures (up to 100) to store this information. For each product we store the following
information:


- PLU code: Price Look Up Code. Unique for each product
- Product Name,
- Product Sales Type: 0 = per unit, 1 = per pound
- Price Per Pound or Price Per Unit,
- Current Inventory Level.



For example:


4011 BANANAS 1 0.49 123.2
4383 MINNEOLAS 1 0.79 187.3
3144 TANGERINES 1 1.19 135.5
4028 STRAWBERRIES_PINT 0 0.99 104
4252 STRAWBERRIES_HALF_CASE 0 3.99 53
4249 STRAWBERRIES_FULL_CASE 0 7.49 67



B) Your program should:


1. Read inventory from the file products.txt that is attached to hw5.


2. Perform check-out functionality in a separate method/function.


3. Enable the user to purchase several products in each checkout.


4. After the user enters PLU code, ask the user to input the weight or # of units for each
product (depending on its sales type) and update the total ($).


5. User can enter 0 for PLU code to indicate the end of checkout.


6. If the total purchase exceeds $50, apply 5% discount to the total.


7. A list of items and its price should be displayed along with the total due before and after
discount


8. You should perform input validation (i.e. PLU should be integer, no symbols or letters are
valid as PLU, unit price, sales type or stock).


You need to keep track of inventories automatically as well. So, keep updating the inventory data
along with checkout operations. When the store closes every day, inventory product information
should be displayed and updated in the file inventory.txt.


Guidelines

Explanation / Answer

product.cpp





//product.h