@@ -26,15 +26,14 @@ public void example()
2626
2727 public int [ ] one ( )
2828 {
29- throw new NotImplementedException ( ) ;
3029 int [ ] numbers = { 42 , 13 , 17 , 91 } ;
3130
3231 // 1. Values contained in an array are each stored at a unique numeric index, starting from 0 ascending in order.
3332 // E.g. The first value is at index 0, the second at index 1, the third at index 3.
3433 // Using an index, change the number 17 in the numbers array to 68
3534 // WRITE YOUR CODE BETWEEN THIS LINE...
3635
37-
36+ numbers [ 2 ] = 68 ;
3837
3938 // ... AND THIS LINE
4039
@@ -43,14 +42,13 @@ public int[] one()
4342
4443 public String two ( )
4544 {
46- throw new NotImplementedException ( ) ;
4745 String [ ] teachers = { "Nathan" , "Ed" , "Dave" , "Carlo" , "Lewis" , "Jules" , "John" , "Chris" , "Nigel" } ;
4846
4947 //TODO: 2. Using an array index, change the value of the teacher variable below to be the fourth
5048 // teacher contained in the teachers array
5149 // WRITE YOUR CODE BETWEEN THIS LINE...
5250
53- String teacher = "" ;
51+ String teacher = teachers [ 3 ] ;
5452
5553 // ... AND THIS LINE
5654
@@ -59,26 +57,24 @@ public String two()
5957
6058 public String [ ] three ( )
6159 {
62- throw new NotImplementedException ( ) ;
6360 //TODO: 3. Create a string array named cars that contains three names of car manufacturers: Audi, BMW and Dodge
6461 // WRITE YOUR CODE BETWEEN THIS LINE...
6562
66-
63+ String [ ] cars = { "Audi" , "BMW" , "Dodge" } ;
6764
6865 // ... AND THIS LINE
6966
70- // return cars;
67+ return cars ;
7168 }
7269
7370 public int four ( )
7471 {
75- throw new NotImplementedException ( ) ;
7672 int [ ] numbers = { 42 , 13 , 17 , 91 } ;
7773
7874 // TODO 4. Using array indices, set the value of the result variable below to the sum of every number in the numbers array
7975 // WRITE YOUR CODE BETWEEN THIS LINE...
8076
81- int result = 0 ;
77+ int result = numbers . Sum ( ) ;
8278
8379 // ... AND THIS LINE
8480
@@ -87,11 +83,10 @@ public int four()
8783
8884 public float [ ] five ( )
8985 {
90- throw new NotImplementedException ( ) ;
9186 //TODO: 5. Create an array called floats that contains 3 floating point numbers: 9.62, 23.17 and 3.14
9287 // WRITE YOUR CODE BETWEEN THIS LINE...
9388
94- float [ ] floats ;
89+ float [ ] floats = { 9.62f , 23.17f , 3.14f } ;
9590
9691
9792 // ... AND THIS LINE
0 commit comments