Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

>> REGISTER NOW TO START POSTING

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:
```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.

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

Also an underscore

`Calculate Taylor_Polynomials tp=newCalculate_Taylor_Polynomials();`
`Calculate_Taylor_Polynomials tp=new Calculate_Taylor_Polynomials();`