Question
Java II: In NetBeans IDE - Write a class with the following static methods: WordCounter: This method takes a String and returns the number of
Java II: In NetBeans IDE -
Write a class with the following static methods: WordCounter: This method takes a String and returns the number of words in the String. convertToString: This method takes an ArrayList of Characters and returns a String representation of the characters. mostFound: This method takes a String and returns the character that appears the most in the String. Ignore the case when counting. replacePart: This method takes 3 Strings original, toReplace, replaceWith. It finds all occurrences of toReplace in the original String and returns the original String with toReplace replaced with replaceWith. For example, if the original String was I have two dogs and two cats, toReplace is two and replaceWith is three, the method returns the String I have three dogs and three cats. Write a main method that: Asks the user for a String, a toReplace String and a replaceWith String. It prints: Number of words in the String The character that appears the most in the String The new String after calling replacePart Asks the user for a series of characters and creates an ArrayList of these characters. The user should press . when done entering characters. It then prints out the Characters as a String (using convertToString) and prints the String in all upper case.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started