#C1250. Inventory Operations Manager
Inventory Operations Manager
Inventory Operations Manager
You are given a series of operations to manage an inventory system. The operations include:
- ADD item: Add a new item with the following attributes: item name, category, price, and quantity.
- UPDATE item: Update the price and quantity of an existing item.
- QUERY operation: Query all items in a specific category that have a price less than or equal to a given threshold. The result should be sorted lexicographically. If no item satisfies the condition, return "None".
The operations are provided as input, and your task is to perform them in order. For each QUERY
operation, output the names of matching items – one per line in the order specified by the query result.
The comparison for the price condition is given by the inequality \(price \leq threshold\).
inputFormat
The first line contains an integer \(n\) (the number of operations). Each of the next \(n\) lines contains a single operation. An operation can be one of the following:
ADD item_name category price quantity
UPDATE item_name new_price new_quantity
QUERY category price_threshold
All prices are floating point numbers and quantities are integers.
outputFormat
For each QUERY
operation, output the names of the items satisfying the condition, each on a new line. If no items match, output a single line with None
.
4
ADD Laptop Electronics 999.99 10
ADD Headphones Electronics 199.99 5
ADD T-Shirt Clothing 29.99 50
QUERY Electronics 200.00
Headphones
</p>