Construction of exact solutions to a family of wave equations by the functional variable method