A device that changes mechanical energy to electrical energy by rotating a coil of wire through a magnetic field is called a(n)