forked from khalidabuhakmeh/MoonPhaseConsole
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
32 lines (28 loc) · 964 Bytes
/
Program.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
using System;
using System.Linq;
namespace MoonPhaseConsole
{
partial class Program
{
static void Main(string[] args)
{
var dates = new[] {
new DateTime(2020, 7, 27),
new DateTime(2020, 7, 28),
new DateTime(2020, 8, 3),
new DateTime(2020, 8, 11),
new DateTime(2020, 8, 19),
new DateTime(2014,1,1)
};
var results =
dates
.Select(x => Moon.Calculate(x))
.Select((r, i) => $"{r.Emoji} {r.Name} ({r.DaysIntoCycle} days, Visibility {Math.Round(r.Visibility, 2)}%)\n")
.Aggregate((a, v) => a + v);
Console.WriteLine();
Console.WriteLine(results);
var result = Moon.Now();
Console.WriteLine(result);
}
}
}