A course in thermodynamics and heat engines