DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  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 05:10 PM.

  2. #2
    Join Date
    Mar 2004
    Posts
    635
    doesn't a quadratic equation have 2 possible answer?

Similar Threads

  1. JDOM Classpath Help Required
    By kpandya in forum Java
    Replies: 5
    Last Post: 01-15-2006, 07:10 PM
  2. JDOM Errors & How to set the classpath
    By kpandya in forum Java
    Replies: 0
    Last Post: 01-14-2006, 07:01 PM
  3. Help with class/applet
    By none_none in forum Java
    Replies: 17
    Last Post: 04-28-2005, 03:00 PM
  4. Replies: 5
    Last Post: 10-17-2002, 01:58 PM
  5. Assembly class
    By Shailesh C.Rathod in forum .NET
    Replies: 2
    Last Post: 03-13-2002, 07:53 PM

Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links