Let the fruit grower use x bags of brand P and y bags of brand Q.
The problem can be formulated as follows. Maximize z = 3x + 3.5y … (1) subject to the constraints,

The feasible region determined by the system of constraints is as follows.

The corner points are A (140, 50), B (20, 140), and C (40, 100).
The values of z at these corner points are as follows.

The maximum value of z is 595 at (140, 50).
Thus, 140 bags of brand P and 50 bags of brand Q should be used to maximize the amount of nitrogen.
The maximum amount of nitrogen added to the garden is 595 kg.