import java.io.*;
import javagently.*;
class CW2Q1
{
//Main program to run the Gaussian Quadrature.
public static void main(String[] args) throws IOException
{
Gauss_Quadrature_Data = new Gauss_Quadrature_Data();
Gauss.input_data();
Gauss.cal_x();
Gauss.cal_fx();
Gauss.cal_sum();
Gauss.store_x_output();
Gauss.store_f_output();
BufferedReader user_keyin= Text.open(system.in);
System.out.print("What is your a");
int input_a = Text.readint(user_keyin);
System.out.print("What is your b");
int input_b = Text.readint(user_keyin);
System.out.print("What is your n");
int input_n = Text.readint(user_keyin);
}
static class Gauss_Quadrature_Data
{
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
{
//BufferedReader user_keyin = Text.open(System.in);
//System.out.print("User please key in the arraysize:");
BufferedReader user_file = Text.open("CW2Q1_data.txt");
}
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;
}
}