I plan revise my program to handle polynomial equations with one variable.

i.e.

Code:

` 5x² - 3x + 7 - x ...`

(x + 7)*(3 - x)

So I am planning to create a class or function which handles, for the time being, addition, subtraction and multiplication of polynomials.

Any ideas or pointers in the right direction would be useful.

At present I have had the following ideas.

To convert all terms into the form :-

Where 'a' and 'b' are just integers.

So x^2 would be:-

5x would be:-

And just plain ordinary numbers such as '7' would be:-

Recall that x^0 = 1

so 7^1 = 7.

Since each term will have three stages. It will be reasonably easy to separate the coefficients from the exponents and do the appropriate math.

For my addition/subtraction class I have this idea.

Code:

`String Addition (string A, string B)`

{

A = "3x + 7"; » 3x^1 + 7x^0

B = "4x² - 8x"; » 4x^2 - 8x^1

... Count no. terms in string A and B

Create a nested for loop, looping through the no. terms

Add together coefficients if the exponents are equal

return string;

}

For my multiplication class I have this idea.

Code:

`String Multiplication (string A, string B)`

{

A = "x+2"; »1x^1 + 2x^0

B = "x-3"; »1x^1 + 3x^0

...Count no. terms in string A and B

Create a nested for loop, looping through the no. terms

Multiply coefficients and exponents, of course is a

little more complicated than this but you get the idea.

return string;

}

Thanks