How to Seperate String to Perform Count?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lpc403
    New Member
    • Mar 2008
    • 1

    How to Seperate String to Perform Count?

    New to Java (and programming in general) and trying to accept a sentence from the command line to count the consonants, vowels, and punctuation. What code do I need to perform the following?

    1) Seperate each word so that it runs through the swtich to perform a count

    2) Loop back to get each subsequent word until the sentence ends

    I have it working when setting the sentence as a varible and reading it. Not sure how to take this next step.
  • sukatoa
    Contributor
    • Nov 2007
    • 539

    #2
    Originally posted by lpc403
    New to Java (and programming in general) and trying to accept a sentence from the command line to count the consonants, vowels, and punctuation. What code do I need to perform the following?

    1) Seperate each word so that it runs through the swtich to perform a count

    2) Loop back to get each subsequent word until the sentence ends

    I have it working when setting the sentence as a varible and reading it. Not sure how to take this next step.
    If i were to implement that, i will convert the args[0] to an array of characters...

    start's from 0 to the max length of the char array, i will compare each character with the consonants, vowels and punctuations... .

    Update us,
    Sukatoa

    Comment

    • BigDaddyLH
      Recognized Expert Top Contributor
      • Dec 2007
      • 1216

      #3
      Post your best attempt and ask a specific question about your code.

      Comment

      Working...