Question: I need a C programming code. Here's the description Here's the provided code The provided starter code is an attempt to emulate a grocery store
I need a C programming code. Here's the description


Here's the provided code


The provided starter code is an attempt to emulate a grocery store checkout system. It is intended to have the following features: - Allows the user to scan at least 5 different types of items - The user can "cancel" the most recent item (in case of an accidental double entry or second-guessing their purchase) - Can be told when the current checkout is "done," and will calculate the sub-total, the tax on that sub-total, and the final total with tax The main loop is done for you - when the user enters ' d ' at the prompt the loop will exit. Complete the rest of the functionality. A possible approach to take: - Start by defining and adding variables and conditions to check for the five different items. The \#def ine features at the top of the code are just an illustration of one method of defining constant values in C. - Keep track of the total values for each item, and once the loop has exited, confirm (via printf( ) ) that you've initialized and updated these variables correctly. - Apply the formula to calculate the sub-total and test. - Apply the formula to calculate the tax and total and test. (Iowa sales tax is 6-7\%) - Consider the "cancel" feature last. Note that you only need to support a single cancel operation at a time supporting an arbitrary number of cancels is possible but quite a bit trickier. Example input/outputs are shown below assuming: AApples:$1.45MMilk:$3.79EEggs:$4.75 $./ main Welcome to HyMore supermarket, where there are supportive smiles in every aisle. Please scan your purchases here. Enter ' C ' to cancel last item or ' d ' when done. Item 1: A Item 2: d Thank you for shopping. Your sub-total is 1.45 With tax that comes to 1.54 Your instructor takes cash or debit (please, no American Express) do \{ printf("Item \&d: ", item_num) scanf(" sc", \&item_scan); item_num = item_num + 1 1) When the user enters ' C ' they are cancelling the last item if (item_scan =c ) \{ printf( "Last item cancelled ); \} 11 When the user enters ' d ' they are done if (item_scan == 'd') \{ done =1 \} 1/ User wants 1 more apple - what should we do? if (item_scan =A ') \{ \} 3 while (done =0 ); printf( "IninThank you for shopping. Your sub-total is $10.2f , subtotal); printf("With tax that comes to 810.2f ", total); printf( "Your instructor takes cash or debit (please, no American Express) in". return 0 ; \}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
