Results 1 to 3 of 3
  1. #1
    bdl1127 is offline Member
    Join Date
    Jan 2012
    Posts
    26
    Rep Power
    0

    Default Infix to postfix using queue

    Hey guys, im trying to write a single class program that uses a Queue to change an infix expression to postfix expression. The infix expression will be a string that will be input by the user. Before I start coding, I want to make sure I have all the possible methods that I will need to complete the program. The methods that I believe I will need are listed below. It would be great if you guys could suggest some methods to add or take out some of the ones I mentioned. Thanks in advance.

    1. Main: ultimately runs program and gathers user input
    2. checkParens: checks to make sure the parentheses in the postfix are balanced
    3. checkOperans: checks to make sure there are sufficient/insufficient operands in the user input postfix
    4. checkOperators: checks to make sure there are sufficient/insufficient operators in the user input postfix

  2. #2
    bdl1127 is offline Member
    Join Date
    Jan 2012
    Posts
    26
    Rep Power
    0

    Default Re: Infix to postfix using queue

    nothing?

  3. #3
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,785
    Rep Power
    7

    Default Re: Infix to postfix using queue

    Depending upon how you code the conversion you may not need all the check methods. For example once the conversion has complete and the stack is not empty then you now that the original infix equation was invalid. Also, as you are converting the infix equation you know you must read operand:operator:operand:operator:operand etc. So if you try reading an operand but get an operator (or vice versa) you know the equation is invalid.

Similar Threads

  1. need help converting from infix to postfix notation
    By miatech in forum New To Java
    Replies: 1
    Last Post: 06-27-2012, 09:10 PM
  2. Trouble with converting infix to postfix
    By mustachio in forum New To Java
    Replies: 7
    Last Post: 07-21-2011, 03:48 AM
  3. Infix to Postfix using array
    By Franneldort in forum New To Java
    Replies: 0
    Last Post: 10-11-2010, 05:57 PM
  4. Replies: 1
    Last Post: 07-05-2008, 03:08 PM
  5. Replies: 0
    Last Post: 04-15-2008, 07:36 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
  •