Which of the following is a machine that converts mechanical energy into electrical energy?
A. compressor
B. generator
C. motor shaft
D. rotor blade