Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exercise_complete #75

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
24 changes: 11 additions & 13 deletions csharp-fundamentals-arrays.Main/Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,14 @@ public void example()

public int[] one()
{
throw new NotImplementedException();
//throw new NotImplementedException();
int[] numbers = { 42, 13, 17, 91 };

// 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 3.
// Using an index, change the number 17 in the numbers array to 68
// WRITE YOUR CODE BETWEEN THIS LINE...


numbers[2] = 68;

// ... AND THIS LINE

Expand All @@ -43,14 +42,14 @@ public int[] one()

public String two()
{
throw new NotImplementedException();
//throw new NotImplementedException();
String[] teachers = { "Nathan", "Ed", "Dave", "Carlo", "Lewis", "Jules", "John", "Chris", "Nigel" };

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

String teacher = "";
String teacher = new String(teachers[3]);

// ... AND THIS LINE

Expand All @@ -59,26 +58,26 @@ public String two()

public String[] three()
{
throw new NotImplementedException();
//throw new NotImplementedException();
//TODO: 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

//return cars;
return cars;
}

public int four()
{
throw new NotImplementedException();
//throw new NotImplementedException();
int[] numbers = { 42, 13, 17, 91 };

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

int result = 0;
int result = numbers.Sum();

// ... AND THIS LINE

Expand All @@ -87,12 +86,11 @@ public int four()

public float[] five()
{
throw new NotImplementedException();
//throw new NotImplementedException();
//TODO: 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;

float[] floats = { 9.62f, 23.17f, 3.14f };

// ... AND THIS LINE

Expand Down
Loading