Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Done in Java. Any help appreciated! Create a class named Lab3Exercises and Implement the following static methods (we will not use this class to instantiate
Done in Java. Any help appreciated!
Create a class named Lab3Exercises and Implement the following static methods (we will not use this class to instantiate objects) and write JUnit testswhen asked:
b) public static String computeBothEnds (String input) i. Write a static Java method that takes several words (or an entire line) as input and computes a word by combining first and last letter of each word. For example, if the given words (or line is "Hello, my name is Fred A Frank Flintstone", then your method should return "HomyneisFdAAFkFe". Notice that the comma and space are not part of the output. Ignore other special characters too and make sure your program can process both uppercase and lowercase letters. Words with single letter will have same letter for first and last. If there are no characters in input, then return null. ii. Use the Scanner class to get the input. You may use a loop if needed. iii. Test your method from main for both cases when it returns characters from both ends and also when it returns a null. iv. Write appropriate Junit tests
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