Final answer:
The first car consumed 15 gallons and the second car consumed 30 gallons.
Step-by-step explanation:
In order to find out how many gallons were consumed by each of the two cars, we can set up a system of equations.
Let x be the number of gallons consumed by the first car and y be the number of gallons consumed by the second car.
We can write the following equations based on the given information:
- x + y = 45 (the total gas consumption)
- 15x + 35y = 1275 (the total distance traveled)
To solve this system of equations, we can use the substitution method. Solving equation 1 for x, we get x = 45 - y. Substituting this into equation 2, we have 15(45 - y) + 35y = 1275. Simplifying this equation, we get 675 - 15y + 35y = 1275. Combining like terms, we have 20y = 600. Dividing both sides by 20, we get y = 30. Substituting this value of y back into equation 1, we get x = 45 - 30 = 15.
Therefore, the first car consumed 15 gallons and the second car consumed 30 gallons.