Skip to content

Commit f65b5e2

Browse files
author
Jonatan Berg Romundgard
committed
Passed all tests.
1 parent 337b13b commit f65b5e2

File tree

1 file changed

+12
-12
lines changed
  • csharp-fundamentals-arrays.Main

1 file changed

+12
-12
lines changed

csharp-fundamentals-arrays.Main/Core.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ public void example()
2626

2727
public int[] one()
2828
{
29-
throw new NotImplementedException();
29+
//throw new NotImplementedException();
3030
int[] numbers = { 42, 13, 17, 91 };
3131

3232
// 1. Values contained in an array are each stored at a unique numeric index, starting from 0 ascending in order.
3333
// E.g. The first value is at index 0, the second at index 1, the third at index 3.
3434
// Using an index, change the number 17 in the numbers array to 68
3535
// WRITE YOUR CODE BETWEEN THIS LINE...
3636

37-
37+
numbers[2] = 68;
3838

3939
// ... AND THIS LINE
4040

@@ -43,14 +43,14 @@ public int[] one()
4343

4444
public String two()
4545
{
46-
throw new NotImplementedException();
47-
String[] teachers = { "Nathan", "Ed", "Dave", "Carlo", "Lewis", "Jules", "John", "Chris", "Nigel" };
46+
//throw new NotImplementedException();
47+
string[] teachers = { "Nathan", "Ed", "Dave", "Carlo", "Lewis", "Jules", "John", "Chris", "Nigel" };
4848

4949
//TODO: 2. Using an array index, change the value of the teacher variable below to be the fourth
5050
// teacher contained in the teachers array
5151
// WRITE YOUR CODE BETWEEN THIS LINE...
5252

53-
String teacher = "";
53+
string teacher = teachers[3];
5454

5555
// ... AND THIS LINE
5656

@@ -59,26 +59,26 @@ public String two()
5959

6060
public String[] three()
6161
{
62-
throw new NotImplementedException();
62+
//throw new NotImplementedException();
6363
//TODO: 3. Create a string array named cars that contains three names of car manufacturers: Audi, BMW and Dodge
6464
// WRITE YOUR CODE BETWEEN THIS LINE...
6565

66-
66+
string[] cars = { "Audi", "BMW", "Dodge" };
6767

6868
// ... AND THIS LINE
6969

70-
//return cars;
70+
return cars;
7171
}
7272

7373
public int four()
7474
{
75-
throw new NotImplementedException();
75+
//throw new NotImplementedException();
7676
int[] numbers = { 42, 13, 17, 91 };
7777

7878
// TODO 4. Using array indices, set the value of the result variable below to the sum of every number in the numbers array
7979
// WRITE YOUR CODE BETWEEN THIS LINE...
8080

81-
int result = 0;
81+
int result = numbers.Sum();
8282

8383
// ... AND THIS LINE
8484

@@ -87,11 +87,11 @@ public int four()
8787

8888
public float[] five()
8989
{
90-
throw new NotImplementedException();
90+
//throw new NotImplementedException();
9191
//TODO: 5. Create an array called floats that contains 3 floating point numbers: 9.62, 23.17 and 3.14
9292
// WRITE YOUR CODE BETWEEN THIS LINE...
9393

94-
float[] floats;
94+
float[] floats = {9.62f, 23.17f, 3.14f};
9595

9696

9797
// ... AND THIS LINE

0 commit comments

Comments
 (0)