What device converts mechanical energy into electrical energy?

a. Motor
b. Resistor
c. Magnet
d. Generator

d. Generator