Results 1 to 3 of 3
  1. #1
    kekcklemen is offline Member
    Join Date
    Feb 2011
    Posts
    4
    Rep Power
    0

    Default equations in java

    Java Code:
    public class Equation {
    public void main(String [] args){
        String equation="3x=6";
    // HMMMMMMMMM?
    System.out.println(x); //x=2 <---how
    }
    }
    Hay guys... Anyone knows how to solve this equation?

  2. #2
    snotmare is offline Member
    Join Date
    Apr 2011
    Posts
    34
    Rep Power
    0

    Default

    You could rewrite your code to this...
    System.out.println("x= " + (6 / 3));

    Or, if you are wanting to pass in a string and have it spit out a result, you'll need to create a String parser to do the work for you. There might be an API out there that someone has written, so do some googling and you might get lucky!

  3. #3
    Jodokus's Avatar
    Jodokus is offline Senior Member
    Join Date
    Jan 2011
    Location
    Amsterdam, the Netherlands
    Posts
    230
    Rep Power
    4

Similar Threads

  1. Output Equations in Java
    By jlbird in forum New To Java
    Replies: 5
    Last Post: 11-02-2010, 04:24 PM
  2. linear systems of equations
    By tyang in forum New To Java
    Replies: 2
    Last Post: 03-24-2010, 04:13 PM
  3. Finding the intercept using two equations.
    By MapleLeafRag in forum New To Java
    Replies: 1
    Last Post: 12-03-2009, 09:32 PM
  4. Solving this equations problem in Java
    By matt_well in forum New To Java
    Replies: 17
    Last Post: 08-30-2008, 10:05 PM
  5. equations
    By Peter in forum New To Java
    Replies: 2
    Last Post: 07-04-2007, 07:15 AM

Posting Permissions

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