using Newtonsoft.Json.Linq;
using System.Collections.Generic;
private static Dictionary<string, string> stateList = new Dictionary<string,string>(){
["massachusetts"] = "MA",
["new hampshire"] = "NH",
["north carolina"] = "NC",
["south carolina"] = "SC",
["west virginia"] = "WV",
static void Main(string[] args)
Console.WriteLine("Please Enter the state you currently live in.");
Console.WriteLine("Enter either the Full State Name or the State Initials.");
Console.WriteLine("Ex: New York OR NY");
string myState = Console.ReadLine();
if(stateList.ContainsKey(myState.ToLower())){
Console.WriteLine($"Current state is {stateList[myState]}");
}else if(stateList.ContainsValue(myState)){
Console.WriteLine($"Current state is {stateList[myState]}");
static class TaxeeApiHelper
private static readonly string apiKey = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJBUElfS0VZX01BTkFHRVIiLCJodHRwOi8vdGF4ZWUuaW8vdXNlcl9pZCI6IjYwMWE0YmZhMmU0YTQwNTY4MWMyZGUyMyIsImh0dHA6Ly90YXhlZS5pby9zY29wZXMiOlsiYXBpIl0sImlhdCI6MTYxMjMzNjEyMn0.lSYBCW41iniY975_EJ_MkoOhJB5bxkKOPkTkgk3Dzq8";
private static readonly string taxeeUrlFederalIncome = $"https://taxee.io/api/v2/federal/2020";
private static readonly string taxeeUrlStateIncome = "https://taxee.io/api/v2/state/2020/";
static public void getTaxInfo(string currentState)
JObject federalTaxJson = taxeeIncomeTaxInfo(taxeeUrlFederalIncome);
JObject stateTaxJson = taxeeIncomeTaxInfo(taxeeUrlStateIncome + $"{currentState}");
Console.WriteLine("DEBUG: Federal Tax JSON---------------------BEGIN");
foreach (var pair in federalTaxJson)
Console.WriteLine("{0}: {1}", pair.Key, pair.Value);
Console.WriteLine("DEBUG: Federal Tax JSON-----------------------END");
Console.WriteLine("DEBUG: State Tax JSON-----------------------BEGIN");
foreach (var pair in stateTaxJson)
Console.WriteLine("{0}: {1}", pair.Key, pair.Value);
Console.WriteLine("DEBUG: State Tax JSON-------------------------END");
static private JObject taxeeIncomeTaxInfo(string taxeeURL)
WebRequest taxeeWebRequestURl = WebRequest.Create(taxeeURL);
taxeeWebRequestURl.Method = "GET";
taxeeWebRequestURl.ContentType = "application/json";
taxeeWebRequestURl.Headers.Add("Authorization", $"Bearer {apiKey}");
Stream urlStream = taxeeWebRequestURl.GetResponse().GetResponseStream();
StreamReader urlStreamReader = new StreamReader(urlStream);
string responseFromServer = urlStreamReader.ReadToEnd();
return JObject.Parse(responseFromServer);