diff --git a/src/main/java/com/booleanuk/core/Exercise.java b/src/main/java/com/booleanuk/core/Exercise.java index 7ac3cfb..3359843 100644 --- a/src/main/java/com/booleanuk/core/Exercise.java +++ b/src/main/java/com/booleanuk/core/Exercise.java @@ -35,7 +35,7 @@ public String greet(String name) { Complete this method so that it increases the number given by 1 and returns the result */ public int increment(int number) { - return 0; + return ++number; } /* @@ -48,8 +48,8 @@ public int increment(int number) { Nathan | Hi, Nathan :) Edward | Hi, Edward :) */ - public String happilyGreet() { - return "Not implemented yet"; + public String happilyGreet(String name) { + return "Hi, " + name + " " + ":)"; } /* @@ -64,6 +64,16 @@ public String happilyGreet() { 10, 13 | [10,11,12,13] -1, 1 | [-1,0,1] */ + public int[] constructNumberArray (int lower, int upper) { + int[] result = new int[(upper-lower)+1]; + int index = 0; + + for (int i = lower; i <= upper; i++) { + result[index] = i; + index++; + } + return result; + } @@ -81,7 +91,7 @@ The method must return the same string in upper case with exclamation marks (!) error, 10 | ERROR!!!!!!!!!! */ - - - + public String shout(String info, int num) { + return info.toUpperCase() + "!".repeat(num); + } }