explain how electricity and magnetism work in an electromagnet so that a crane can lift heavy metal objects.