Answer:
The question does not mention when does the farmer has to sell the cattles in the future. So assuming the cattles are to be sold in the next 3 months.
The farmer can short 3 contracts that have 3 months to maturity. Two contracts would be of the 40k cattles whereas one of 20k.
Explanation:
When the prices of the cattles falls in the future, the gain on the futures contract will offset the loss on the sale of the cattle. Whereas, when the prices of cattle rises in the future, the gain on the sale of the cattle will be offset by the loss on the futures contract.
So basically, using futures contracts to hedge has the advantage that it can at no cost reduce risk to almost zero.