Need help with a Quadratic Expression class...


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Need help with a Quadratic Expression class...

Threaded View

  1. #1
    Join Date
    Apr 2006
    Location
    Columbia, Mo
    Posts
    4

    Question 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 06:10 PM.

Similar Threads

  1. JDOM Classpath Help Required
    By kpandya in forum Java
    Replies: 5
    Last Post: 01-15-2006, 08:10 PM
  2. JDOM Errors & How to set the classpath
    By kpandya in forum Java
    Replies: 0
    Last Post: 01-14-2006, 08:01 PM
  3. Help with class/applet
    By none_none in forum Java
    Replies: 17
    Last Post: 04-28-2005, 04:00 PM
  4. Replies: 5
    Last Post: 10-17-2002, 02:58 PM
  5. Assembly class
    By Shailesh C.Rathod in forum .NET
    Replies: 2
    Last Post: 03-13-2002, 08: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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center