Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions src/main/java/com/booleanuk/core/Exercise.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 + 1;
}

/*
Expand All @@ -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 + " :)";
}

/*
Expand All @@ -64,6 +64,15 @@ public String happilyGreet() {
10, 13 | [10,11,12,13]
-1, 1 | [-1,0,1]
*/
public int[] constructNumberArray(int lower, int upper) {
int[] numberArray = new int[upper - lower + 1];
int i = lower;
for (int j = 0; j < numberArray.length; j++) {
numberArray[j] = i;
i++;
}
return numberArray;
}



Expand All @@ -81,7 +90,8 @@ The method must return the same string in upper case with exclamation marks (!)
error, 10 | ERROR!!!!!!!!!!
*/




public String shout(String string, int number) {
return string.toUpperCase() + "!".repeat(Math.max(0, number));
}
}

Loading