A generator is a device that converts mechanical energy into electrical energy, thereby producing electric current.