Re: Quadratuc Read Method

What is the syntax of the full expression?

Will it always have three expressions separated by sign operators? Could some of the parts be omitted? say two expressions and one sign operator?

<exp> <sign> <exp> <sign> <exp>

You need to parse the full expression and break it into sub parts: expressions<exp> and signs<sign>

What tokens make an <exp>

what tokens are valid <sign>

Re: Quadratuc Read Method

It could be any various combination of things it could be ax^2-c, bx+c, ax^2-bx+c, ax^2. It's supposed to work for all the different possibilities. But the only signs will be + and - . But a,b, and c will always be whole integers. And the number represented by a will always be with x^2 and so on. Also if the equation was x+3, a must be set equal to 0, b would be set equal to 1 and c would be 0.

Re: Quadratuc Read Method

The choices are one of these three?

<expr>

<expr> <sign> <expr>

<expr> <sign> <expr> <sign> <expr>

Then the code needs to be able to parse out <expr> and <sign> from the String that was entered.

Re: Quadratuc Read Method

Yes that is the case it seems. But I am unsure of how to do that.

Re: Quadratuc Read Method

What characters make up an <expr>? Is there an implied * between a and x in ax?

What characters make a <sign>

What separates an <expr> from a <sign>

Re: Quadratuc Read Method

A <expr> would be made up of either ax^2, bx, or c. a, b, and c are represented by integers in the actual equation. A <sign>would be represented by a plus or minus. Nothing separates an <expr> from a <sign>. The user inputs an equation such as this example: 3x^2-16x+8

Re: Quadratuc Read Method

The real expressions that are entered will have numbers where the discussion so far has talked about a,b,c.

Will the next character after the optional leading number be x?

All of that should now define what an <expr> can be made of.

Do you have enough now to write the code to parse an <expr>?

Re: Quadratuc Read Method

Yes the next character would be an x in the cases of a and b, but not for c. I'm getting there though.