One kilogram of ammonia initially at 8.0 bar and 50°C undergoes a process to 4.5 bar, 20°C while being rapidly expanded in a piston–cylinder assembly. Heat transfer between the ammonia and its surroundings occurs at an average temperature of 40°C. The work done by the ammonia is 40 kJ. Kinetic and potential energy effects can be ignored. Determine the heat transfer, in kJ, and the entropy production, in kJ/K.