Do you have to read in the entire formula? Or can you ask the user for separate values? The latter is going to be much much easier.


public static void main(String[] args)
{
Scanner scan =...