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

    Question How do I input an equation with all of the math operators included?

    I want to make a calculator, but I don't want to use too many cases. Is there a way to input an equation with all of the operators included? For example, I would input an equation such as 5 + 2 - 1 and then have it print 6 or whatever the answer may be. Thanks in advance.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,763
    Blog Entries
    7
    Rep Power
    21

    Default Re: How do I input an equation with all of the math operators included?

    Quote Originally Posted by jerdaniel View Post
    I want to make a calculator, but I don't want to use too many cases. Is there a way to input an equation with all of the operators included? For example, I would input an equation such as 5 + 2 - 1 and then have it print 6 or whatever the answer may be. Thanks in advance.
    Read my blog articles; one talks about a ScriptEngine (notably Javascript) that can do the job for you; another article talks about an expression compiler (and evaluator) that can also do the job for you.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    jerdaniel is offline Member
    Join Date
    Sep 2011
    Posts
    3
    Rep Power
    0

    Default Re: How do I input an equation with all of the math operators included?

    I thank you for the suggestion, but when I try to get to your blog posts, it says I don't have permission to do that.

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,763
    Blog Entries
    7
    Rep Power
    21

    Default Re: How do I input an equation with all of the math operators included?

    Quote Originally Posted by jerdaniel View Post
    I thank you for the suggestion, but when I try to get to your blog posts, it says I don't have permission to do that.
    How strange; can you see the line "Blog entries" at the top right of my reply? (It says "7"); can you click that link? Otherwise there's a tab near the top of the page; it says "Blogs" and it should lead you to all the blog entries. Let me know what happens and I see if they can fix it or tell us why you can't do it (it should've something to do with the number of posts you've made ...)

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Math equation in Java Applet
    By calnastic in forum New To Java
    Replies: 10
    Last Post: 06-23-2011, 08:36 AM
  2. Reading a Math Equation in the console
    By JonB319 in forum New To Java
    Replies: 7
    Last Post: 06-10-2011, 02:54 PM
  3. How import statements are included
    By gpr in forum New To Java
    Replies: 6
    Last Post: 02-25-2011, 01:52 AM
  4. Need help with math equation
    By annabellastorm in forum New To Java
    Replies: 4
    Last Post: 01-10-2010, 06:12 PM
  5. [SOLVED] getting program's math right from file input
    By gotenks05 in forum New To Java
    Replies: 4
    Last Post: 02-20-2009, 02:26 AM

Tags for this Thread

Posting Permissions

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