Results 1 to 4 of 4
  1. #1
    kMel90 is offline Member
    Join Date
    Dec 2010
    Posts
    2
    Rep Power
    0

    Question Help with stacks

    How would I use stacks in java to do a calculation like: 4*((3+3)/(5-3)) ?

    Or should I use something besides stacks? :confused:

  2. #2
    Zack's Avatar
    Zack is offline Senior Member
    Join Date
    Jun 2010
    Location
    Destiny Islands
    Posts
    692
    Rep Power
    5

    Default

    You mean you want to write a lexical analyzer?

    What's your skill level like with Java? If you're just beginning, this isn't a project for you.

  3. #3
    kMel90 is offline Member
    Join Date
    Dec 2010
    Posts
    2
    Rep Power
    0

    Default

    I'm not just beginning, but I'm still pretty new to Java. I've made a calculator before, so now I want to improve it to do more complicated calculations. I learn pretty fast, I just need someone to point me in the right direction.

  4. #4
    Zack's Avatar
    Zack is offline Senior Member
    Join Date
    Jun 2010
    Location
    Destiny Islands
    Posts
    692
    Rep Power
    5

    Default

    Alright, well, here's a whitepaper on operator-precedence parsing... it's the one I used to create mine. It's just theory though, converting it to a usable code is up to you.
    Operator Precedence Parsing

    Here's Wikipedia on the subject...
    Operator-precedence parser - Wikipedia, the free encyclopedia

    And lastly, I will make a quick suggestion... Work with something simple like "1+2+3" to start with. ;)

    Good luck!

Similar Threads

  1. Help with stacks
    By Srcee in forum New To Java
    Replies: 5
    Last Post: 11-01-2009, 12:23 PM
  2. Arithmetic Stacks
    By unc123w in forum New To Java
    Replies: 22
    Last Post: 10-21-2008, 09:24 PM
  3. Stacks, lists...
    By little_polarbear in forum New To Java
    Replies: 7
    Last Post: 08-02-2008, 02:59 PM
  4. Stacks
    By Zosden in forum Advanced Java
    Replies: 15
    Last Post: 05-05-2008, 09:16 AM
  5. Using Stacks
    By ravian in forum New To Java
    Replies: 7
    Last Post: 11-28-2007, 10:53 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
  •