Java Count 'Em Right?
-
Call your project CountEmRight and create just one class, Tester. In the main method, do the following: • Create a loop that asks for String input (a sentence). • Release from the loop if the input String is “EXIT”. • So as to ignore case, convert the input String into an uppercase version of itself. • Concatenate some “harmless” String to the end of the input String. By “harmless” it is meant that it should not contain any occurrences of the delimiter expression. This is the real secret to this project… to get any occurrence of the sought after expression off the end and into the “interior” of the String. • Use the split method to produce a String array (call it sp). Then use sp.length –1 to count the number of occurrences. A typical run will appear as follows: Type in a sentence and press ENTER. His initials are SA There are 2 occurrences. Type in a sentence and press ENTER. Sad but true, their teams are better. There are 2 occurrences. Type in a sentence and press ENTER. S a sa ssa s a There are 4 occurrences. Type in a sentence and press ENTER. exit
-
Answer:
This is pretty simple. Do you have a specific question, or are you just expecting someone to do your homework for you? @M
McFate at Yahoo! Answers Visit the source
Related Q & A:
- How To Count Sleeps Till Christmas?Best solution by terrycassell.com
- How To Count Days Till Christmas?Best solution by Yahoo! Answers
- How to Implement Gateway Service something similar to Oracle API gateway Using Java and Java based Open Source frameworks only?Best solution by Quora
- How do I get mail in my in-box without the right address or right name?Best solution by Yahoo! Answers
- Difference between Java 2 and Java 6?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.