Skip to content

Commit

Permalink
[cli] works for now, needs to be finished
Browse files Browse the repository at this point in the history
  • Loading branch information
pkoscik committed Mar 25, 2022
1 parent f7a3a84 commit 138427a
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions cli.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,37 @@
namespace Weather
{
//TODO: Implement C/F icon (add field in Weather class)
public class Cli
{

public static void printCurrent(Geolocation.Place place, Weather forecast)
{
string current = new string("");

current += $"Current weather in: {place.name}, {place.country}\n";
current += $"{forecast.weatherCurrent.main}, {forecast.weatherCurrent.temp} degrees";

Console.WriteLine(current);
}

//TODO: finish this monseter
public static void printDaily(Geolocation.Place place, Weather forecast)
{
string output = new string("");
string current = new string("");

output += $"Current weather in: {place.name}, {place.country}\n";
output += $"Temperature: {forecast.weatherCurrent.temp}";
current += $"Current weather in: {place.name}, {place.country}\n";
current += $"{forecast.weatherCurrent.main}, {forecast.weatherCurrent.temp} degrees";

Console.WriteLine(output);
string hourlyForecast = new string("");

foreach (var hour in forecast.weatherHourly.list)
{
hourlyForecast += $"{hour.datetime.ToString("HH:mm tt")}: {hour.temp} °C\n";

}

Console.WriteLine(current);
Console.WriteLine(hourlyForecast);
}

// TODO: implement weekly forecast
Expand Down

0 comments on commit 138427a

Please sign in to comment.