Skip to content

Commit bf837ea

Browse files
ClémentClément
authored andcommitted
Cleaning TempStats solution.
1 parent bc8939c commit bf837ea

3 files changed

Lines changed: 19 additions & 6 deletions

File tree

source/code/projects/2DarrayExercise/2DarrayExercise/Program.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ static void Main()
1818
Console.WriteLine("We now rotate the array.");
1919
Rotate(ref matrix1);
2020
Display(matrix1);
21-
21+
2222
// Example array2
2323
int[,] matrix2 =
2424
{
2525
{ 1, 2, 3, 4 },
2626
{ 5, 6, 7, 8 },
27-
{ 9, 10, 11, 12 }
27+
{ 9, 10, 11, 12 },
2828
};
2929
// End of example array2
3030
Console.WriteLine("Example 2:");
@@ -64,9 +64,12 @@ static void Rotate(ref int[,] matP)
6464
{
6565
tmp[row, col] = matP[
6666
// This would be incorrect:
67-
// tmp.GetLength(0) - col, row
67+
// tmp.GetLength(0) - col, row
6868
// can you figure out why?
69-
tmp.GetLength(1) - col - 1, row
69+
tmp.GetLength(1)
70+
- col
71+
- 1,
72+
row
7073
];
7174
}
7275
}

source/code/projects/TempStats/TempStats/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ static void Main()
5151
{
5252
Console.WriteLine("Mode: " + test.Mode);
5353
}
54-
catch
54+
catch (NotImplementedException ex)
5555
{
56-
Console.WriteLine("This set has no mode");
56+
Console.WriteLine(ex.Message);
5757
}
5858
}
5959
}

source/code/projects/TempStats/TempStats/TempStats.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,14 @@ public double Median
8080
}
8181
}
8282
}
83+
public double Mode
84+
{
85+
get
86+
{
87+
// Mode is not implemented.
88+
throw new NotImplementedException(
89+
"Mode property is not implemented."
90+
);
91+
}
92+
}
8393
}

0 commit comments

Comments
 (0)