diff --git a/src/main/java/com/booleanuk/core/Exercise.java b/src/main/java/com/booleanuk/core/Exercise.java index 4d002b4..b820f21 100644 --- a/src/main/java/com/booleanuk/core/Exercise.java +++ b/src/main/java/com/booleanuk/core/Exercise.java @@ -21,11 +21,7 @@ public int[] one() { // 1. Values contained in an array are each stored at a unique numeric index, starting from 0 ascending in order. // E.g. The first value is at index 0, the second at index 1, the third at index 2. // Using an index, change the number 17 in the numbers array to 68 - // WRITE YOUR CODE BETWEEN THIS LINE... - - - - // ... AND THIS LINE + numbers[2] = 68; return numbers; } @@ -37,7 +33,7 @@ public String two() { // teacher contained in the teachers array // WRITE YOUR CODE BETWEEN THIS LINE... - String teacher = ""; + String teacher = teachers[3]; // ... AND THIS LINE @@ -47,14 +43,11 @@ public String two() { public String[] three() { // 3. Create a string array named cars that contains three names of car manufacturers: Audi, BMW and Dodge // WRITE YOUR CODE BETWEEN THIS LINE... - + String[] cars = {"Audi", "BMW", "Dodge"}; // ... AND THIS LINE - - // Then change the code below to remove the dummyArray completely and return the cars array you created above instead. - String[] dummyArray = {}; - return dummyArray; + return cars; } public int four() { @@ -64,7 +57,7 @@ public int four() { // sum of every number in the numbers array // WRITE YOUR CODE BETWEEN THIS LINE... - int result = 0; + int result = numbers[0]+numbers[1]+numbers[2]+numbers[3]; // ... AND THIS LINE @@ -74,13 +67,13 @@ public int four() { public float[] five() { // 5. Create an array called floats that contains 3 floating point numbers: 9.62, 23.17 and 3.14 // WRITE YOUR CODE BETWEEN THIS LINE... - + float[] floats = {9.62F, 23.17F, 3.14F}; // ... AND THIS LINE // Then change the code below to remove the dummyArray completely and return the floats array you created instead - float[] dummyArray = {}; - return dummyArray; + + return floats; } }