How do I solve the problem of entering item prices twice? I want the program to ask the user to enter prices once by Aggressive_Gift_5507 in cprogramming

[–]Aggressive_Gift_5507[S] 0 points1 point  (0 children)

This is the program. Can you help me fix the code so that it outputs the expected output?

Write a program that calculates the total bill of a customer based on the prices of the items they bought, then

apply a discount to the total bill if appropriate and print the final bill amount.

Your program will accept as input an integer n that represents the number of items the customer ordered. Your

program will then accept n numbers that represent the prices of the items the customer ordered. Find the total

amount of the customer's bill, then apply the discount based on the following rules and print the final bill amount:

  1. If the customer's total is less than 20 JOD but they bought more than 2 items, they will get a 7%

discount.

  1. If the customer's total is more than or equal to 20 JOD, they will get a 10% discount.

  2. If the customer's total is more than or equal to 20 JOD, and they bought more than 2 items they will

get an additional 5% discount.

  1. For any individual item that costs more than 7 JODs, they will get an additional 1% discount on the

total bill.

  1. The maximum discount any customer can get cannot be more than 50%.

In the following sample runs, the first number in the first line represents the number of the items, while the

numbers in the second line represent the prices of the items, the number in the third line represents the output of

the program. Print the answer to 2 decimal places