Let the number of units produced for products P, Q, and R be 5x, 6x, and 9x respectively.
The total initial cost of production is calculated as follows:
For product P: 5x × 200 = 1000x
For product Q: 6x × 250 = 1500x
For product R: 9x × 300 = 2700x
Therefore, the total initial cost of production = 1000x + 1500x + 2700x = 5200x
40% of the units of product P were defective, which is 0.4 × 5x = 2x units. The cost of these defective units increased by 25%, so the new cost per defective unit is 200 × 1.25 = 250. The cost
for defective units = 2x × 250 = 500x. The cost for non-defective units (60% or 3x units) = 3x × 200 = 600x.
Total revised cost for product P = 500x + 600x = 1100x
30% of the units of product Q were defective, which is 0.3 × 6x = 1.8x units. The cost of these defective units increased by 30%, so the new cost per defective unit is 250 × 1.30 = 325. The
cost for defective units = 1.8x × 325 = 585x. The cost for non-defective units (70% or 4.2x units) = 4.2x × 250 = 1050x.
Total revised cost for product Q = 585x + 1050x = 1635x
20% of the units of product R were defective, which is 0.2 × 9x = 1.8x units. The cost of these defective units increased by 20%, so the new cost per defective unit is 300 × 1.20 = 360. The
cost for defective units = 1.8x × 360 = 648x. The cost for non-defective units (80% or 7.2x units) = 7.2x × 300 = 2160x.
Total revised cost for product R = 648x + 2160x = 2808x.
Total revised cost for all products = 1100x + 1635x + 2808x = 5543x
The total revenue is as follows:
For product P: 5x × 250 = 1250x
For product Q: 6x × 320 = 1920x
For product R: 9x × 380 = 3420x
Total revenue = 1250x + 1920x + 3420x = 6590x
Overall profit = Total Revenue - Total Cost = 6590x − 5543x = 1047x

Therefore, the overall percentage profit for the factory is approximately 18.89%.