Results 1 to 3 of 3

Thread: Using the Quadratic expression help...

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2005
    Location
    Columbia, Mo
    Posts
    8

    Question Using the Quadratic expression help...

    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; Jun 19th, 2006 at 04:11 PM.

  2. #2
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: Using the Quadratic expression help...

    This seems to be right!!
    I don't know what is the problem here!!!
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2005
    Location
    Columbia, Mo
    Posts
    8

    Resolved Re: Using the Quadratic expression help...

    Quote Originally Posted by ComputerJy
    This seems to be right!!
    I don't know what is the problem here!!!
    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
    Last edited by bckck5; Jun 19th, 2006 at 10:14 PM. Reason: Resolved

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width