From 3adc8abbf3fd7d20a11694772e849928841706f3 Mon Sep 17 00:00:00 2001 From: vllavanya <65501898+vllavanya@users.noreply.github.com> Date: Mon, 23 Nov 2020 18:15:37 +0000 Subject: [PATCH] Update Exercise005.java Logic added --- .../techreturners/exercise005/Exercise005.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/techreturners/exercise005/Exercise005.java b/src/main/java/com/techreturners/exercise005/Exercise005.java index 26020ff..a08256c 100644 --- a/src/main/java/com/techreturners/exercise005/Exercise005.java +++ b/src/main/java/com/techreturners/exercise005/Exercise005.java @@ -26,7 +26,18 @@ public class Exercise005 { // Good luck and enjoy! public String[] mexicanWave(String str) { - // Your code here! - return new String[] {}; + List stringList = new ArrayList(); + + for (int i = 0; i < str.length(); i++) { + char[] temp = str.toCharArray(); + if (temp[i] != ' ') { + temp[i] = Character.toUpperCase(temp[i]); + stringList.add(new String(temp)); + } + + } + + return (String[]) stringList.toArray(); + } -} \ No newline at end of file +}