-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path_03_TridimensionalDemo.cs
73 lines (63 loc) · 2.6 KB
/
_03_TridimensionalDemo.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using System;
public class _03_TridimensionalDemo
{
static void Main(string[] args)
{
demo1();
demo2();
}
private static void demo1()
{
string[] months = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "Octorber", "Nocvember", "December" };
int[] preciptationPerMonth = { 5, 3, 6, 2, 1, 0, 0, 8, 10, 5, 3, 6 };
// Printing precipitation per month
for (int i = 0; i < preciptationPerMonth.Length; i++)
{
Console.WriteLine($"{months[i]}= {preciptationPerMonth[i]}");
}
string[] states = { "California", "Florida", "Nevada", "Texas" };
int[,] preciptationPerMonthPerState =
{
{11, 13, 16, 15, 10, 10, 15, 18, 10, 15, 10, 12},
{19, 21, 25, 22, 31, 35, 50, 38, 20, 45, 25, 24},
{10, 11, 12, 12, 15, 20, 11, 12, 15, 17, 15, 18},
{11, 11, 13, 11, 21, 13, 10, 15, 14, 13, 15, 27},
};
Console.WriteLine("Precipitation Per State/Month report:");
for (int i = 0; i < states.Length; i++)
{
Console.WriteLine($"State: {states[i]}");
for (int j = 0; j < months.Length; j++)
{
Console.WriteLine($" {months[j]}= {preciptationPerMonthPerState[i, j]}");
}
}
}
private static void demo2()
{
string[] months = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "Octorber", "November", "December" };
int[] preciptationPerMonth = { 5, 3, 6, 2, 1, 0, 0, 8, 10, 5, 3, 6 };
// Printing precipitation per month
for (int i = 0; i < preciptationPerMonth.Length; i++)
{
Console.WriteLine($"{months[i]}= {preciptationPerMonth[i]}");
}
string[] states = { "California", "Florida", "Nevada", "Texas" };
int[][] preciptationPerMonthPerState =
{
new int[] {11, 13, 16, 15, 10, 10, 15, 18, 10, 15, 10, 12},
new int[] {19, 21, 25, 22, 31, 35, 50, 38, 20, 45, 25, 24},
new int[] {10, 11, 12, 12, 15, 20, 11, 12, 15, 17, 15, 18},
new int[] {11, 11, 13, 11, 21, 13, 10, 15, 14, 13, 15, 27},
};
Console.WriteLine("Precipitation Per State/Month report:");
for (int i = 0; i < states.Length; i++)
{
Console.WriteLine($"State: {states[i]}");
for (int j = 0; j < preciptationPerMonthPerState[i].Length; j++)
{
Console.WriteLine($" {months[j]}= {preciptationPerMonthPerState[i][j]}");
}
}
}
}