Reading a Math Equation in the console

Hey all,

I have a quick question about reading in an equation. In one of my textbooks it has an exercise where it asks us to write a program that creates a table which displays the results of any given growth function. The table is just each part of the equation, and powers of ten results for each part, and then the last column having all the equation and the same numbers plugged in. Like this:

Number(n) 15n^2 45n 15n^2+45n

1 15 45 60

2 60 90 150

5 375 225 600

10 1500 450 1950

From there it just uses powers of ten.... Now my program has to take any given growth function and make a table like this out of it..... This is my second Java course and I have no idea how to do this. Any pointers anyone can throw me? The table is no big deal, but how can I read an equation from the console, and split up each part? It needs to able to take exponents, cubed, squared, and logarithm. I really appreciate any input I can get on this one, I have spent the last couple hours looking through books but I can't find anything. Thanks!