Question
Objective: Write a program that creates a helper class called StringHelper . This class has methods not already built into strings, but should be because
Objective:
Write a program that creates a helper class called StringHelper. This class has methods not already built into strings, but should be because they are super useful.
First create a class called StringHelper which has the following static methods
meshStrings: This method takes in two strings via parameters, meshes them together, and returns the meshed strings. Meshing alternates the each character in the first string with every character in the next string. If there are not enough characters to fully mesh then the rest will be appended to the end. For instance if the two strings were harp and fiddle the returned string will be hfairdpdle. replaceVowelsWithOodle: This method takes in one string via parameter, and returns the string with every vowel (a,e,i,o,u) replaced by the phrase oodle. For instance if the string is burrito then the returned string would be boodlerroodletoodle. Also case does not matter. weight: Much like length returns the number of characters in a string, the weight gives the weight in kilograms. This method takes in a string and returns a double value corresponding to its weight. Everyone knows that a words weight is determined by each vowel (a,e,i,o,u) counting as 2.5 kilograms and each consonant as 3.4 kilograms.
Finally create a class called StringHelperTester
This class DOES HAVE a main method Test each method multiple times to determine if they work.
Example Dialog:
Welcome to the String Helper Tester
Meshing harp with fiddle
hfairdpdle
Replacing vowels with oodle in the word burrito
Boodlerroodletoodle
The weight of the word taco is
11.8
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