-
Need help with a Quadratic Expression class...
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;
}
}
Last edited by bckck5; 06-19-2006 at 05:10 PM.
-
doesn't a quadratic equation have 2 possible answer?
Similar Threads
-
Replies: 5
Last Post: 01-15-2006, 07:10 PM
-
Replies: 0
Last Post: 01-14-2006, 07:01 PM
-
By none_none in forum Java
Replies: 17
Last Post: 04-28-2005, 03:00 PM
-
Replies: 5
Last Post: 10-17-2002, 01:58 PM
-
By Shailesh C.Rathod in forum .NET
Replies: 2
Last Post: 03-13-2002, 07:53 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|