Skip to content
Closed
Show file tree
Hide file tree
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
23 changes: 20 additions & 3 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,9 @@ 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 @@ -65,7 +66,16 @@ public String happilyGreet() {
-1, 1 | [-1,0,1]
*/

public int[] constructNumberArray(int lower, int upper) {
int diff = upper-lower + 1;
int[] answer = new int[diff];

for (int i = 0; i<diff; i++){

answer[i] = lower + i;
}
return answer;
}


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

public String shout(String word, int exclamations) {

String answer = word.toUpperCase();
for (int i = 0; i < exclamations; i++) {

answer += "!";

}
return answer;
}
}
15 changes: 15 additions & 0 deletions src/main/java/com/booleanuk/extension/Extension.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ public class Extension extends ExtensionBase {
*/


public int bakingTime(){
return 50;
}


/*
Expand All @@ -20,7 +23,11 @@ public class Extension extends ExtensionBase {
and the result of calling the bakingTime method
*/

public int remainingBakeTime(int done) {

int number = bakingTime() - done;
return number;
}


/*
Expand All @@ -32,6 +39,10 @@ public class Extension extends ExtensionBase {
*/


public int calculatePrepTime(int layers){

return layers * 3;
}


/*
Expand All @@ -45,6 +56,10 @@ public class Extension extends ExtensionBase {
*/


public int totalTimeSpent(int layers, int minutes){

return calculatePrepTime(layers) + minutes;
}


}
Loading