A coffee machine includes a weighing system to measure the weight of the liquid coffee extracted in a cup and a coffee grinding machine having a weight system to measure the weight of the ground coffee dispensed in a filter-holder. The coffee machine has a control unit provided with a memory, wherein infusion ratios for different types of coffees are saved and the coffee grinding machine includes a control unit operatively connected to the control unit of the coffee machine to send information about the weight of the ground coffee contained in the filter-holder. The control unit of the coffee machine uses the information received from the coffee grinding machine to extract a coffee that satisfies an infusion ratio selected by the operator.