#K11091. Vending Machine Dispense
Vending Machine Dispense
Vending Machine Dispense
This problem simulates a vending machine that accepts money in cents and dispenses an item if sufficient funds are provided. The machine offers three items:
- chips costing \(50\) cents
- soda costing \(75\) cents
- candy costing \(100\) cents
If the inserted amount is at least the price of the selected item, the machine should dispense the item by printing "<item> Dispensed"; if the funds are insufficient, it should print "Insufficient funds"; and if the item is not available, print "Invalid item".
inputFormat
The input consists of two lines:
- An integer representing the amount of money inserted (in cents).
- A string representing the item to purchase (one of "chips", "soda", or "candy").
outputFormat
Output a single line:
- If sufficient funds are provided for a valid item, output "<item> Dispensed".
- If the funds are insufficient, output "Insufficient funds".
- If the item is invalid, output "Invalid item".
50
chips
chips Dispensed