To solve this problem you must apply the proccedure shown below:
 1. You must make a system of equations, as below:
 2. Let's call:
 x: the number of first class tickets bought.
 y: the number of coach tickets bought.
 3. Then, you have:
 x+y=7 (First equation)
 970x+370y=3790 (Second equation)
 x=7-y
 4. By substitution, you have:
 970x+370y=3790
 970(7-y)+370=3790
 y=5
 x=7-y
 x=7-5
 x=2
 Therefore, the answer is:
 - Number of first class tickets bought=2
 - Number of coach tickets bought=5