C# C# Objects Encapsulation and Arrays Arrays

C# array code challenge

Hey guys any help given would be appreciated, cant seem to get the last part of the code right. Thanks

double[] lapTimes = new double[4];

lapTimes[0] = 2.2;

double[] finalLapTimes = new double[4] {2.2,2.3,2.5,2.8};

double lap3 = finalLapTimes[3]

2 Answers

Good job! You are really close.

in this line u can find the problem :

double lap3 = finalLapTimes[3]

you need to assign lap3 to the third item in the array. how u access element in array in c# >> by their index!. so you want to access the THIRD element which is in INDEX 2 since array start in INDEX 0.

so the solution is:

double lap3 = finalLapTimes[2]

thanks bro I appreciate it, worked well