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:
```import java.io.*;
import javagently.*;

class CW2Q1
{
//Main program to run the Gaussian Quadrature.

public static void main(String[] args) throws IOException
{

Gauss.input_data();
Gauss.cal_x();
Gauss.cal_fx();
Gauss.cal_sum();
Gauss.store_x_output();
Gauss.store_f_output();

}

{
double sum, x, fx;
int n=0; n<=3; n++;

if (n==0); {
double [] []  t; c = new double[0.5773502692, -0.5773502692; 1.0000000000, 1.0000000000];
} else
if n==1); {
double [] [] t; c = new double[0.7745966692,	 0.0000000000, -0.7745966692; 0.5555555556, 0.8888888889, 0.5555555556];
}else
if (n==2); {
double [] [] t; c = new double[0.8611363116, 0.3399810436, -0.3399810436, -0.8611363116; 0.3478548451, 0.6521451549, - 0.6521451549, - 0.3478548451];
} else
if (n==3); {
double [] [] t; c =new double[0.9061798459, 0.5384693101, 0.0000000000, -0.5384693101, -0.9061798459;  0.2369268850, 0.4786286705, 0.5688888889, 0.4786286705, 0.2369268850];
}
}

void input_data() throws IOException
{
//System.out.print("User please key in the arraysize:");
}

void cal_x()
{
cal_x = ((b-a)*(double)(t)+b+a)/2;
return cal_x;
}

void cal_fx()
{
cal_fx = Math.pow(x[t],2)*math.sin (x[t])*(b-a)/2;
return cal_fx;
}

void cal_sum()
{ // this section calculates the sum of a product c*fx
double cal_sum(double fx, double c)
sum = 0.0;
double cal_sum = sum + (double)(c)*(double)(fx);
return cal_sum;
}
}```

```import java.io.*;

public class CW2Q1 {

public static void main(String[] args)throws IOException {
Gauss.input_data();
Gauss.cal_x();
Gauss.cal_fx();
Gauss.cal_sum();
Gauss.store_x_output();
Gauss.store_f_output();

}

{
double sum, x, fx;
for (int n=0; n<=3; n++;){
}

if (n==0) {
double [] []  t; c = new double[0.5773502692, -0.5773502692; 1.0000000000, 1.0000000000];
} else
if n==1) {
double [] [] t; c = new double[0.7745966692,	 0.0000000000, -0.7745966692; 0.5555555556, 0.8888888889, 0.5555555556];
}else
if (n==2) {
double [] [] t; c = new double[0.8611363116, 0.3399810436, -0.3399810436, -0.8611363116; 0.3478548451, 0.6521451549, - 0.6521451549, - 0.3478548451];
} else
if (n==3) {
double [] [] t; c =new double[0.9061798459, 0.5384693101, 0.0000000000, -0.5384693101, -0.9061798459;  0.2369268850, 0.4786286705, 0.5688888889, 0.4786286705, 0.2369268850];
}
}

void input_data() throws IOException
{
//System.out.print("User please key in the arraysize:");
}

void cal_x()
{
cal_x = ((b-a)*(double)(t)+b+a)/2;
return cal_x;
}

void cal_fx()
{
cal_fx = Math.pow(x[t],2)*math.sin (x[t])*(b-a)/2;
return cal_fx;
}

void cal_sum()
{ // this section calculates the sum of a product c*fx
double cal_sum(double fx, double c)
sum = 0.0;
double cal_sum = sum + (double)(c)*(double)(fx);

}
}

}```

here is my code for you.. I reduce some errors ?
but Still It has an error..