コード例 #1
0
        public static void Main(string[] args)
        {
            //Initialize the repository
            SpaceStation spaceStation = new SpaceStation("Apolo", 10);
            //Initialize entity
            Astronaut astronaut = new Astronaut("Stephen", 40, "Bulgaria");

            //Print Astronaut
            Console.WriteLine(astronaut); //Astronaut: Stephen, 40 (Bulgaria)

            //Add Astronaut
            spaceStation.Add(astronaut);
            //Remove Astronaut
            spaceStation.Remove("Astronaut name"); //false

            Astronaut secondAstronaut = new Astronaut("Mark", 34, "UK");

            //Add Astronaut
            spaceStation.Add(secondAstronaut);

            Astronaut oldestAstronaut  = spaceStation.GetOldestAstronaut();    // Astronaut with name Stephen
            Astronaut astronautStephen = spaceStation.GetAstronaut("Stephen"); // Astronaut with name Stephen

            Console.WriteLine(oldestAstronaut);                                //Astronaut: Stephen, 40 (Bulgaria)
            Console.WriteLine(astronautStephen);                               //Astronaut: Stephen, 40 (Bulgaria)

            Console.WriteLine(spaceStation.Count);                             //2
            Console.WriteLine(spaceStation.GetAstronaut("kuro moy"));

            Console.WriteLine(spaceStation.Report());
            //Astronauts working at Space Station Apolo:
            //Astronaut: Stephen, 40 (Bulgaria)
            //Astronaut: Mark, 34 (UK)
        }
コード例 #2
0
        static void Main(string[] args)
        {
            SpaceStation spaceStation = new SpaceStation("Apolo", 10);

            Astronaut astronaut = new Astronaut("Stephen", 40, "Bulgaria");

            Console.WriteLine(astronaut); //Astronaut: Stephen, 40 (Bulgaria)


            spaceStation.Add(astronaut);

            spaceStation.Remove("Astronaut name"); //false

            Astronaut secondAstronaut = new Astronaut("Mark", 34, "UK");


            spaceStation.Add(secondAstronaut);

            Astronaut oldestAstronaut  = spaceStation.GetOldestAstronaut();    // Astronaut with name Stephen
            Astronaut astronautStephen = spaceStation.GetAstronaut("Stephen"); // Astronaut with name Stephen

            Console.WriteLine(oldestAstronaut);                                //Astronaut: Stephen, 40 (Bulgaria)
            Console.WriteLine(astronautStephen);                               //Astronaut: Stephen, 40 (Bulgaria)

            Console.WriteLine(spaceStation.Count);                             //2

            Console.WriteLine(spaceStation.Report());
        }
コード例 #3
0
        public static void Main()
        {
            SpaceStation spaceStation = new SpaceStation("Apolo", 10);

            Astronaut astronaut = new Astronaut("Stephen", 40, "Bulgaria");

            Console.WriteLine(astronaut);

            spaceStation.Add(astronaut);

            spaceStation.Remove("Astronaut name");

            Astronaut secondAstronaut = new Astronaut("Mark", 34, "UK");

            spaceStation.Add(secondAstronaut);

            Astronaut oldestAstronaut = spaceStation.GetOldestAstronaut();

            Astronaut astronautStephen = spaceStation.GetAstronaut("Stephen");

            Console.WriteLine(oldestAstronaut);
            Console.WriteLine(astronautStephen);

            Console.WriteLine(spaceStation.Count);

            Console.WriteLine(spaceStation.Report());
        }
コード例 #4
0
ファイル: StartUp.cs プロジェクト: Kerozov/CSharp-SoftUni
        static void Main(string[] args)
        {
            var astronaut  = new Astronaut("zefir", 11, "BG");
            var astronaut2 = new Astronaut("zefir", 13, "BG");
            var astronaut3 = new Astronaut("zefir", 14, "BG");
            var astronaut4 = new Astronaut("zefir", 15, "BG");
            var cosmos     = new SpaceStation("Amfo", 4);

            cosmos.Add(astronaut);
            cosmos.Add(astronaut);
            cosmos.Add(astronaut2);
            cosmos.Add(astronaut3);
            Console.WriteLine(cosmos.Count);
            Console.WriteLine(cosmos.Remove("zefir"));
            Console.WriteLine(cosmos.Report());
            Console.WriteLine(cosmos.GetOldestAstronaut());
            Console.WriteLine(cosmos.GetAstronaut("zefir"));
        }
コード例 #5
0
        static void Main(string[] args)
        {
            SpaceStation spaceStation = new SpaceStation("Apolo", 10);

            Astronaut firstAstronaut = new Astronaut("Stephen", 40, "Bulgaria");

            Console.WriteLine(firstAstronaut);

            spaceStation.Add(firstAstronaut);

            Astronaut secondAstronaut = new Astronaut("John", 50, "America");

            spaceStation.Add(secondAstronaut);

            Console.WriteLine(spaceStation.GetOldestAstronaut());

            Console.WriteLine(spaceStation.GetAstronaut("John"));

            Console.WriteLine(spaceStation.Count);

            Console.WriteLine(spaceStation.Report());
        }