Question: Requirements for the main Function 1. Prompt the user for the number of transactions to be entered. Remember that counts are always integers. 2. Create

Requirements for the main Function 1. Prompt the user for the number of transactions to be entered. Remember that counts are always integers. 2. Create two parallel arrays using the value entered by the user in Step 1: a. One array will store the purchase amounts. Use the appropriate data type and a meaningful name for this array. b. The other array will store the replies to the spirit wear question. Use the appropriate data type and a meaningful name for this array. 3. Within a counter-controlled loop: Prompt the user for the purchase amount and store their reply in the appropriate element of the purchase amount array. b. Prompt the user about spirit wear and store their reply in the appropriate element of the spirit wear array. 4. After the first loop completes, call the function to display the column headings. This is a new function for this assignment. See the "Requirements for Printing Column Headings" section below. 5. Then set up a second counter-controlled loop. This loop will read one element from each array, and pass those values to the function that calculates the new purchase amount. This is a new function for this assignment. See the "Requirements for Computing the New Purchase Amount" section below. b. Remember that the inputs to this function are read from the two parallel arrays.

Requirements for Computing the New Purchase Amount This function requires two inputs: the transaction amount entered by the user, and the answer to the spirit wear question. 1. Determine if there should be a discount applied to the user's purchase. 2. If there should be a discount applied: a. Determine which discount (7% or 10%) should be applied.

b. Calculate the dollar amount of the discount calling function 1 as noted in the "Week 05 Functions" section above. Save the result of this function. c. Calculate the new purchase amount by calling function 2 as noted in the "Week 05 Functions" section above. Save the result of this function. 3. Calculate the dollar amount of tax that should be added on by calling function 3 as noted in the "Week 05 Functions" section above. Remember to use the updated amount if a discount has been applied. Save the result of this function. 4. Calculate the total purchase amount by calling function 4 Functions" section above. Save the result of this function. This function should then call the function that prints the current transaction information. This is a new function for this assignment.

Requirements for Printing Column Headings This function prints the column headings in the output. Give this function a meaningful name. Hint: In order to get the headings and the data to line up neatly, you will need to use format control strings for the headers. Remember the headers are all strings, and strings are automatically right-aligned within the space allocated for them in a format control string. If you want to left-align, include the negative sign in the fcs. Requirements for Printing the Transaction Information This function prints one line of data. All data must line up neatly as shown in the sample run. All dollar values must be right-aligned under the appropriate column header and display two values after the decimal.

Sample Run How many transactions? 3 Enter the purchase amount> 50.00 Does this purchase include Spirit Wear (Y/N)?> N Enter the purchase amount> 50.00 Does this purchase include Spirit Wear (Y/N)?> y Enter the purchase amount> 150 Does this purchase include Spirit Wear (Y/N)?> Y Purchase Spirit Wear? Purchase After Discount Tax Final Purchase 50.00 N 50.00 2.50 52.50 50.00 y 46.50 2.33 48.83 150.00 Y 135.00 6.75 141.75

**Use printf and always use fflush(stdin) in every scanf**

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!