# Class Polynom

```java.lang.Object
|
+----Polynom
```

public class Polynom
extends Object
This class implements polynom. It used to calculate the equations while the calculations are done The class itself contains coefficient of polynom, and calculates equation's (polynom's) roots.

##  Polynom()
Constructs empty polynom.

##  addPolynom(Polynom)
Adds two polynoms (one is given as argument). calculateRoots()
Calculates polynom's roots (run appropriate function according to coefficients). getCoef(int)
Returns coefficient's value by its index. getResult(double)
Calculates result with given x. reset()
Resets polynom to unit polynom. setCoef(int, double)
Sets coefficient's value by its index. toString()
Returns a string representation of the object.

##  Polynom
``` public Polynom()
```
Constructs empty polynom.

##  reset
``` public void reset()
```
Resets polynom to unit polynom. setCoef
``` public void setCoef(int coefNum,
double value)
```
Sets coefficient's value by its index.

Parameters:
coefNum - coefficient index.
value - coefficient value. getCoef
``` public double getCoef(int coefNum)
```
Returns coefficient's value by its index.

Returns:
coefficient. addPolynom
``` public void addPolynom(Polynom p)
```
Adds two polynoms (one is given as argument).

Parameters:
p - polynom to add. calculateRoots
``` public double[] calculateRoots()
```
Calculates polynom's roots (run appropriate function according to coefficients).

Returns:
array with roots. getResult
``` public double getResult(double x)
```
Calculates result with given x.

Parameters:
x - x.
Returns:
value of polynom in x. toString
``` public String toString()
```
Returns a string representation of the object.

Returns:
a string representation of the object.
Overrides:
toString in class Object