Solve the below problem:
Q: A 0.5-m diameter balloon containing air at 200 kPa, 300 K, is attached by a valve to an air line flowing air at 400 kPa, 400 K. The valve is now opened, allowing air to flow into the balloon until the pressure inside reaches 300 kPa, at which point the valve is closed. The final temperature inside the balloon is 350 K. The pressure is directly proportional to the diameter of the balloon. Find the work and heat transfer during the process.