Here is the code that I wrote to solve the problem:
Code:
public class Equation {
public void doCalculations(int a, int b, int c, int d){
int j;
for (int i=-10;i<=10;i++){
if((a*(i*i*i)+ b*(i*i)+ c*(i)+ d)==0){
j=i;
int int_array[] = new int[3];
for(int k=0;k<int_array.length;k++)
int_array[k]=j;
System.out.println("The value of X1 is :" + int_array[0]);
System.out.println("The value of X2 is :"+ int_array[1]);
System.out.println("The value of X3 is :"+ int_array[2]);
}
}
}
public static void main(String[]args){
Equation equation = new Equation();
equation.doCalculations(1, -6, 11, -6);
}
}
Here are sample results that I get after running the program:
The value of X2 is :1
The value of X3 is :1
The value of X1 is :2
The value of X2 is :2
The value of X3 is :2
The value of X1 is :3
The value of X2 is :3
The value of X3 is :3
May anyone out there help me, I'm stuck and I dont know where to begin now. I also accept direct postings to channel.zhou@yahoo.com. Thank you in advance.
The value of X3 is :1
The value of X1 is :2
The value of X2 is :2
The value of X3 is :2
The value of X1 is :3
The value of X2 is :3
The value of X3 is :3
May anyone out there help me, I'm stuck and I dont know where to begin now. I also accept direct postings to channel.zhou@yahoo.com. Thank you in advance.

