In addition, if the total after discount is taken is 40 dollars or more, an additional 10 dollars off discount is applied.
We will assume that the user is purchasing 3 items. For each item, the program reads the price and the category. We will use the following category indicators: Home = 1, Electronics = 2, Everything else = 3. Write a program that finds the final purchase amount.
Example 1: input (price and category for each item): 32.50, 1,
12.99, 2, 3.49, 3
Output: 31.76 (explanation: 32.5 receives 15% discount,
12.99 received 10% discount, and 3.49 received 30% discount. The
total after
discount is taken is 41.76 dollars, since it is over 40 dollars, an
additional 10 dollars off is applied and the final total is 31.76)
Example 2: input: 15.99, 2, 10.99, 1, 1.99, 3
Output: 25.13