A coffee vending machine works by heating water to a certain temperature, then adding ground coffee to an extractor for extraction. Finally, the extracted liquid coffee is dispensed to the customer through a dispenser. Throughout this process, the machine must constantly monitor parameters such as water level, temperature, and concentration, and make appropriate adjustments and controls.