#C4248. Fruit Basket Discount Calculator
Fruit Basket Discount Calculator
Fruit Basket Discount Calculator
You are given a list of fruits, each with a name and a price, and a discount percentage. Your task is to calculate the subtotal after applying the discount.
The subtotal is computed as:
$$\text{Subtotal} = \text{Total Price} - \left(\text{Total Price} \times \frac{\text{Discount}}{100}\right)$$
Round the result to two decimal places. Note that the input is provided via standard input (stdin) and you must print the output to standard output (stdout).
inputFormat
The input is given via standard input in the following format:
n fruit1 price1 fruit2 price2 ... (n lines in total) discount
Where:
n
is an integer representing the number of fruits.- Each of the next n lines contains a fruit name (string without spaces) and its price (a float).
discount
is a float representing the discount percentage.
outputFormat
Output the subtotal after applying the discount. The result must be rounded to two decimal places. If the result is an integer, output it with one decimal digit (for example, 9.0).
## sample3
Apple 3.0
Orange 4.0
Banana 2.0
10.0
8.1