public static void Main() { // 37.235, -115.811111, earth #Area 51 // 51.525888 30.746430 Earth #Chernobyl Nuclear Power Plant while (true) { try { Console.WriteLine("Write a coordinates in format Latitude, Longitude, Planet (eg. earth):"); string[] userInput = Console.ReadLine() .Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries); if (userInput.Length != 3) { throw new ArgumentException("Wrong input, please try again"); } var latitude = double.Parse(userInput[0]); var longitude = double.Parse(userInput[1]); var planet = (Planet)Enum.Parse(typeof(Planet), userInput[2], true); var userCoordnates = new Location(latitude, longitude, planet); Console.WriteLine(userCoordnates); } catch (ArgumentException ex) { Console.Error.WriteLine(ex.Message); } } }
static void Main() { Planet earth = Planet.Earth; var home = new Location(18.037986, 28.870097, earth); Console.WriteLine(home); }
public static void Main() { Location home = new Location(18.037986, 28.870097, Planet.Earth); Location researchLab = new Location(78.037986, -28.870097, Planet.Venus); Location villa = new Location(-8.037986, -178.870097, Planet.Neptune); Console.WriteLine("{0}\n{1}\n{2}", home, villa, researchLab); }
static void Main() { Location home = new Location(18.037987, 28.870097, Planet.Earth); Console.WriteLine(home); Location mars = new Location(25.245212, 45.343454, Planet.Mars); Console.WriteLine(mars); }
public static void Main() { Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("en-US"); Location newLocation = new Location(45.2322, 11.23948, Planet.Uranus); //Console.WriteLine(newLocation); Console.WriteLine(Temperature.DrawTemperatureGraph()); Console.WriteLine(SpaceRotation.LapDays(Planet.Saturn)); }
static void Main(string[] args) { while (true) { Planet planet; double latitude; double longitude; try { Console.WriteLine("Please enter location details in the format: Latitude Longitude Planet"); string[] currentLine = Console.ReadLine() .Split(new []{ ' ', '\t', ',' }, StringSplitOptions.RemoveEmptyEntries); bool validLatitude = double.TryParse(currentLine[0], out latitude); if (!validLatitude) { throw new LatitudeException("Invalid latitude input!"); } bool validLongitude = double.TryParse(currentLine[1], out longitude); if (!validLatitude) { throw new LongitudeException("Invalid longitude input!"); } planet = ValidatePlanet(currentLine[2]); latitude = double.Parse(currentLine[0]); longitude = double.Parse(currentLine[1]); Location home = new Location(latitude, longitude, planet); Console.WriteLine(home); break; } catch (LatitudeException ex) { Console.WriteLine(ex.Message); } catch (LongitudeException ex) { Console.WriteLine(ex.Message); } catch (PlanetException ex) { Console.WriteLine(ex.Message); } catch (IndexOutOfRangeException) { Console.WriteLine("Invalid input!"); } } }
static void Main() { Location locationSaturn = new Location(18.1213, 12.343, Planet.Saturn); Location home = new Location(18.1213, 15.247, Planet.Earth); Location locationMars = new Location(28.3233, 12.343, Planet.Mars); Location locationMercury = new Location(19.13, 12.343, Planet.Mercury); Console.WriteLine(locationSaturn); Console.WriteLine(home); Console.WriteLine(locationMars); Console.WriteLine(locationMercury); }
static void Main() { Location home = new Location(18.037986, -199, Planet.Earth); Console.WriteLine(home); }
private static void Main() { Location home = new Location(18.037986, 28.870097, Planet.Earth); Console.WriteLine(home); }
static void Main(string[] args) { Location locationTest = new Location(12,34,Planet.Mars); Console.WriteLine(locationTest); }
static void Main(string[] args) { Location location = new Location(125.56, 255.12, Planets.Mercury); Console.WriteLine(location); }
static void Main() { Location Sofiq = new Location(11.2, 22.4, Planet.Earth); Console.WriteLine(Sofiq); }
static void Main() { Console.Write("Please enter a Latitude: "); double latitude = double.Parse(Console.ReadLine()); Console.WriteLine(); Console.Write("Please enter a Longitude: "); double longitude = double.Parse(Console.ReadLine()); Location home = new Location(latitude, longitude, Planet.Saturn); Console.WriteLine(home); }
static void Main() { Location sofia = new Location(42.7, 23.33, Planet.Earth); Console.WriteLine(sofia); }
static void Main(string[] args) { Location home = new Location(18.037986, 28.870097, Planet.Earth); Console.WriteLine(home); }
static void Main() { Location firstTest = new Location(23.2323, 56.1232, Planets.Earth); Console.WriteLine(firstTest.ToString()); }
public static void Main() { var home = new Location(18.037986, 28.870097, Planet.Earth); Console.WriteLine(home); }