• January 13th, 2010, 05:20 PM
simply_stunning79
Hello everyone I am a BSC Mathematics student and very beginner in Java Programming and as part of my Mathematics degree I am also learning Algorithm with Java programming. I am in very early stages of Java so I could be making very silly mistake but believe it or not but I am stuck with this error for last 2 days but still cannot figure out where is the problem. Anyone please help me I will really appreciate that.

Following is the programme code I am using:
Code :

```class diy70 { public static void main(String[] args) { int degree; degree = 0;   double px, x; /* px is the variable used to store the result of the polynomial at x. */ Calculate Taylor_Polynomials tp=newCalculate_Taylor_Polynomials(); // Evaluate the polynomial at x = 0.2. x = 0.2; switch (degree) { case 0: px = tp.p0(x); tp.printpx(0.8, x, px); break; case 1: px = tp.p1(x); tp.printpx(0.8, x, px); break; case 2: px = tp.p2(x); tp.printpx(0.8, x, px); break; default: System.out.println("nothing is done."); } } static class Calculate_Taylor_Polynomials { /* Return the result of the polynomial in P.3 Lecture 2 */ double p0(double x) { double pofx =1.0; return pofx; } Double p1 (double x) { double pofx = 1.0 + x; return pofx; } double p2(double x) { double px = 1.0 + x + Math.pow(x,2); return px; } void printpx(int degree, double x, double px) { System.out.println("Degree " + degree + "polynomial"); System.out.println ("P( = " + x + ")=" + px); } } }```
But when I run the above programme I am getting error on line 11 saying something like this:

';' expected and also there is ^ this sign between Polynomials and tp

Will wait for reply and may God bless you for this.
• January 13th, 2010, 05:45 PM
helloworld922
Code :

`Calculate Taylor_Polynomials tp=newCalculate_Taylor_Polynomials();`
It looks like you're missing a space between "new" and "Calculate_Taylor_Polynomials();"
Code :

`Calculate Taylor_Polynomials tp=new Calculate_Taylor_Polynomials(); // fixed`
• January 14th, 2010, 05:06 AM
Freaky Chris
Also an underscore

Code :

`Calculate Taylor_Polynomials tp=newCalculate_Taylor_Polynomials();`
Code :

`Calculate_Taylor_Polynomials tp=new Calculate_Taylor_Polynomials();`
• January 14th, 2010, 05:30 AM
simply_stunning79