Exemplo n.º 1
0
        private static void AddNewConstellation()
        {
            var newConstellation = new Constellation(
                name: GetName(),
                coordinates: GetCoordinates()
                );

            Constellations.Add(newConstellation);

            Console.WriteLine("Success!");
            Console.WriteLine("Press any button to return to the menu.\n");
            Console.ReadKey();
        }
Exemplo n.º 2
0
        private static void SetUp()
        {
            // First constellation.
            var constellation1 =
                new Constellation(
                    name: "Gemini",
                    coordinates: new Coordinates(
                        new Angle(20.23f),
                        new Angle(10.643f)
                        ));

            constellation1.AddStar("Castor", 1.1e8f, 1.4e29, 4.43e28f);
            constellation1.AddStar("Pollux", 2.1e8f, 1.1e29, 3.3e28f);

            constellation1.Stars[0].AddPlanet("Planet1", 1.1e4f, 4.8e21, 1.8e4f, 7.3e5f, 1.1e8f);
            constellation1.Stars[0].AddPlanet("Planet2", 2.2e4f, 3.21e21, 1.28e4f, 17.3e5f, 4.1e8f);

            constellation1.Stars[1].AddPlanet("Planet1", 2.1e4f, 3.1e21, 3.48e4f, 1.3e5f, 4e4f);

            // Second constellation.
            var constellation2 =
                new Constellation(
                    name: "Orion",
                    coordinates: new Coordinates(
                        new Angle(-10.231f),
                        new Angle(67.98f)
                        ));

            constellation2.AddStar("Bitelguse", 1.1e8f, 1.4e29, 4.43e28f);
            constellation2.AddStar("Mintaka", 2.1e8f, 1.1e29, 3.3e28f);

            constellation2.Stars[1].AddPlanet("Planet1", 2.1e4f, 3.1e21, 3.48e4f, 1.3e5f, 4e4f);


            Constellations.Add(constellation1);
            Constellations.Add(constellation2);
        }
Exemplo n.º 3
0
        private static void CorrectStarsInfo(Constellation constellation)
        {
            ShowAllNames(constellation.Stars);
            Console.WriteLine("0. Back to main menu");

            Console.WriteLine("Info of which element you want to correct?");
            var starIndex = GetIntValue(0, constellation.Stars.Count) - 1;

            if (starIndex == -1)
            {
                return;
            }

            Console.WriteLine("What field you want to correct?");
            Console.WriteLine("1) Name");
            Console.WriteLine("2) Radius");
            Console.WriteLine("3) Temperature");
            Console.WriteLine("4) Mass");
            Console.WriteLine("5) Add planet");
            Console.WriteLine("6) Remove planet");
            Console.WriteLine("7) Correct planet info");
            Console.WriteLine("0) Back to main menu");
            Console.WriteLine();

            var field = GetIntValue(0, 7);

            switch (field)
            {
            case 1:
                constellation.Stars[starIndex].Name = GetName();
                break;

            case 2:
                constellation.Stars[starIndex].Radius = GetFloatValue("Input raduis in metres: ");
                break;

            case 3:
                constellation.Stars[starIndex].Temperature = GetFloatValue("Input temperature in Kelvins: ");
                break;

            case 4:
                constellation.Stars[starIndex].Mass = GetFloatValue("Input mass in kg: ");
                break;

            case 5:
                constellation.Stars[starIndex].AddPlanet(
                    name: GetName(),
                    radius: GetFloatValue("Input radius in metres: "),
                    mass: GetFloatValue("Input mass in kg: "),
                    siderealDay: GetFloatValue("Input length of sideral day in seconds: "),
                    siderealYear: GetFloatValue("Input length of sideral year in seconds: "),
                    orbitRadius: GetFloatValue("Input radius of the orbit in metres: ")
                    );
                break;

            case 6:
                Remove(constellation.Stars[starIndex].Planets);
                break;

            case 7:
                CorrectPlanetInfo(constellation.Stars[starIndex]);
                break;

            case 0:
                return;
            }
        }