CharCounter
Question
Write a complete Java program called CharCounter that gets two Strings called inputWord and inputCharacter from
the user at the command line. Check that the character has a length of 1.
- If it doesn’t, provide the user with suitable feedback and conclude the program.
- If the character length is valid (i.e., it has a length of 1), use a while loop to check each position in the inputWord variable and return the number of times the character occurs. For example, if the inputWord is “test” and the inputCharacter is “e” you would output: “There is 1 occurrence of ‘e’ in test.”
PA – AtmSimWhileLoop” aria-describedby=”msf1-previous-desc” >Previous PA – EvenThough” aria-describedby=”msf1-next-desc” >Next