0

a JAVA program that would input a string and display the total number of vowels and total number of consonants. (use method)
Example:
Input a string: beautiful
Total Vowels: 5
Total Consonants: 4

7
Contributors
6
Replies
7
Views
8 Years
Discussion Span
Last Post by Godstryke
0

Can someone give me a code for this? ...

Yes. I won't though. Read the terms and conditions of this site, again, please. You have read them at least once, already, right?

1
System.out.println("I am not putting any effort to code my homework");
Votes + Comments
Nice!
0

Guys, please drop this mocking it doesn't help any of us.

@loozax you should be aware that there is a rule on this forum which says "We only give homework help to those who show effort". So presuming that you still on this task I would recommend you do some coding, post code and ask questions related to code or specific issue and not general request to do your homework

0

Oh, I had to do this one too!

I suggest you start by putting everything you can down in code and then when/if you get stuck the post what you have and we can help you through it. The toughest part is getting yourself started.

1

Identify what the program needs to do very specifically.

  • Prompt the user to input a String
  • Separate the String into separate characters
  • Identify the case of each letter
  • Tally up the number of each type of character
  • Ignore the characters that aren't letters
  • Display the final tally

Briefly list out ways in which you could do each component and then you'll have a much better idea of how to string everything together with code.

To start you off:
Everything you need should be on these two pages:
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Character.html
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html

Good luck.

Votes + Comments
Excellent ideas :)
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.