Page 2 of 2 FirstFirst 12
Results 21 to 25 of 25
  1. #21
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,317
    Rep Power
    25

    Default Re: Help with Delimiters/While loops

    switch between delimiters
    Don't think about delimiters. Think about tokens. You want a class/method that understands tokens.
    If it is given: 8-3+4
    it will return these 5 tokens: 8 & - & 3 & + & 4

    Now look at the pseudo code in post#19.
    If you don't understand my response, don't ignore it, ask a question.

  2. #22
    bubblegum is offline Member
    Join Date
    Sep 2012
    Posts
    19
    Rep Power
    0

    Default Re: Help with Delimiters/While loops

    update total using operator and number
    In the loop...could I write a case statement that uses the + and - as characters??
    Ex:
    Java Code:
    switch(x)
    {
    
    case "-":
    total = total + number;
    break;      
    case "+":
    total = total - number;
    break;
    
    }

  3. #23
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,317
    Rep Power
    25

    Default Re: Help with Delimiters/While loops

    You can now use Strings in switch statements with Java 1.7
    If you don't understand my response, don't ignore it, ask a question.

  4. #24
    bubblegum is offline Member
    Join Date
    Sep 2012
    Posts
    19
    Rep Power
    0

    Default Re: Help with Delimiters/While loops

    Thank you Norm! You helped me solve this problem! :D!

  5. #25
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,317
    Rep Power
    25

    Default Re: Help with Delimiters/While loops

    How did you solve the problem of changing operators in a long expression?
    If you don't understand my response, don't ignore it, ask a question.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 1
    Last Post: 03-25-2012, 02:40 AM
  2. Replies: 16
    Last Post: 01-31-2012, 08:36 PM
  3. Replies: 0
    Last Post: 08-07-2011, 08:32 PM
  4. Replies: 0
    Last Post: 02-21-2011, 11:50 AM
  5. Replies: 1
    Last Post: 04-26-2007, 03:52 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
  •