#C12925. Filter Orders Based on Total Amount
Filter Orders Based on Total Amount
Filter Orders Based on Total Amount
You are given a list of orders where each order is represented by a tuple of three elements: order_id (an integer), customer_name (a string without spaces), and total_amount (a floating-point or integer number). Your task is to filter and output only those orders for which the total amount is strictly greater than a given threshold.
The input is read from standard input (stdin) and the output should be printed to standard output (stdout).
Note: If no order meets the criteria, no output should be printed.
inputFormat
The input consists of several lines:
- The first line contains an integer
N
denoting the number of orders. - The next
N
lines each contain three items separated by spaces: an integerorder_id
, a stringcustomer_name
, and a numbertotal_amount
. - The last line contains a number representing the threshold.
All inputs are read from stdin
.
outputFormat
For each order with a total_amount
strictly greater than the given threshold, output a single line containing the order details: order_id
, customer_name
, and total_amount
(if the amount is an integer, output it without a decimal point) separated by a space. The output should be printed to stdout
. If no order qualifies, output nothing.
5
1 Alice 250
2 Bob 120
3 Charlie 320
4 David 150
5 Eve 480
200
1 Alice 250
3 Charlie 320
5 Eve 480
</p>