Two rigid tanks are connected by a valve

Two rigid tanks are connected by a valve. Tank A is insulated and contains 0.3 m^3 of steam at 400 kPa and 60 percent quality. Tank B is uninsulated and contains 2 kg of steam at 200 kPa and 250∘∘C. The valve is now opened, and steam flows from tank A to tank B until the pressure in tank A drops to 200 kPa. During this process 300 kJ of heat is transferred from tank B to the surroundings at 17∘∘C. Assuming the steam remaining inside tank A to have undergone a reversible adiabatic process, determine

(a) the final temperature in each tank and
(b) the entropy generated during this process.

(a) 120.2∘∘C, 116.1∘∘C,
(b) 0.498 kJ/kgK