PDA

Click to See Complete Forum and Search --> : Using the Quadratic expression help...


bckck5
Jun 19th, 2006, 03:36 PM
so i have this so far but im stuck on adding 2 quadratic expressions not sure what i need to return

public class Quadratic
{
private int a,b,c;

public Quadratic()
{
a = 0;
b = 0;
c = 0;
}

public Quadratic(int userA,int userB,int userC)
{
a = userA;
b = userB;
c = userC;
}

public int getA()
{
return a;
}

public int getB()
{
return b;
}
public int getC()
{
return c;
}

public int getEval(int x)
{
int answer;
answer = (a*(x*x)) + (b*x) + c;
return answer;
}

public static Quadratic sum(Quadratic q1, Quadratic q2)
{
int qsumA, qsumB, qsumC;

qsumA = q1.getA() + q2.getA();
qsumB = q1.getB() + q2.getB();
qsumC = q1.getC() + q2.getC();

Quadratic qsum = new Quadratic(qsumA,qsumB,qsumC);

return qsum;
}

}

ComputerJy
Jun 19th, 2006, 05:11 PM
This seems to be right!!
I don't know what is the problem here!!! :confused:

bckck5
Jun 19th, 2006, 09:17 PM
This seems to be right!!
I don't know what is the problem here!!! :confused:

yea its right the problem was in my test program but i figured it out
i may have one more qeustion then i will mark this resolved
thanks for looking tho
:thumb: :thumb: