Q3. A polynomial is represented by two fields; one is the degree and second is the coefficient. Thus 5x2+ 2x+3 is degree two and its coefficients are coeff[0]=3, coeff[1]=2 and coeff[2]=5. Design a class Polynomial to represent single-variable polynomials which contain the following functionality:
· A zero argument constructor that initializes the degree and coefficients to zero
· A two argument constructor that initializes both the degree and the coefficients array
Code:
public
}
}
}
}
}
}