Here's one way of solving this problem:
Plant 1 has 28 cars, x of which will be sent to dealership A, and the rest, 28-x, will be sent to dealership B.
Transportation cost for Plant 1 to Dealerships A and B will be 220(x) + 300(28-x)
Plant 2 has 8 cars, y of which will be sent to dealership A, and the rest, 8-y, will be sent to dealership B.
Transportation cost for Plant 2 to Dealerships A and B will be 400(y) + 180(8-y)
This would make the total cost the sum of the costs for Plant 1 and Plant 2:
[220(x) + 300(28-x)] + [400(y) + 180(8-y)] = 10640
-80x + 220y +9840 = 10640
Now, since we have 2 variables, we must have 2 unique equations to solve for both of the variables. We have one equation above. Recall that Dealer A needs 20 cars. Plant 1 is sending x many cars to Dealer A, and Plant 2 is sending y many cars to Dealer A. This means x + y = 20. This is your second equation.
Using elimination or substitution, you can now solve for x and y. Let's use substitution.
-80x + 220(20-x) +9840 = 10640
x = 12
y = 8
Plant 1 has 28 cars, 12 of which will be sent to dealership A, and the rest, 28-12, or 16, will be sent to dealership B.
Plant 2 has 8 cars, 8 of which will be sent to dealership A, and the rest, 8-8, or 0, will be sent to dealership B.