implemented Polynomial class