예제 #1
0
파일: main.cs 프로젝트: OOD2020/week4
        static void Main(string[] args)
        {
            List <Team> teams = new List <Team>();
            //List<Player> Players = new List<Player>();

            Team SligoRovers  = new Team("Sligo  Rovers");
            Team FinnHarps    = new Team("Finn  Harps");
            Team GalwayUnited = new Team("Galway  United");
            Team DerryCity    = new Team("Derry  City");
            Team Dundalk      = new Team("Dundalk");

            teams.Add(SligoRovers);
            teams.Add(FinnHarps);
            teams.Add(GalwayUnited);
            teams.Add(DerryCity);
            teams.Add(Dundalk);
            Display(teams);


            SligoRovers.AddResult(Result.Win);
            FinnHarps.AddResult(Result.Loss);
            FinnHarps.AddResult(Result.Draw);
            GalwayUnited.AddResult(Result.Win);
            Dundalk.AddResult(Result.Loss);

            Display(teams);

            teams.Sort();
            teams.Reverse();
            Display(teams);

            List <Player> Players = new List <Player>();

            SligoRovers.Players.Add(new Player()
            {
                Name = "Ed McGinty", Position = "Goalkeeper"
            });
            SligoRovers.Players.Add(new Player()
            {
                Name = "John Mahon", Position = "Defender"
            });
            SligoRovers.Players.Add(new Player()
            {
                Name = "Ronan Coughlan", Position = "Forward"
            });

            Console.WriteLine("\nSligo Rovers Teamsheet");
            foreach (Player player in SligoRovers.Players)
            {
                //Console.WriteLine($"{player.Name} - {player.Position}");
                Console.WriteLine(player);
            }
        }
예제 #2
0
파일: Program.cs 프로젝트: S00185812/Week_5
        static void Main(string[] args)
        {
            Team SligoRovers  = new Team("Sligo  Rovers");
            Team FinnHarps    = new Team("Finn  Harps");
            Team GalwayUnited = new Team("Galway  United");
            Team DerryCity    = new Team("Derry  City");
            Team Dundalk      = new Team("Dundalk");

            var teamList = new List <Team>();

            teamList.Add(SligoRovers);
            teamList.Add(FinnHarps);
            teamList.Add(GalwayUnited);
            teamList.Add(DerryCity);
            teamList.Add(Dundalk);

            SligoRovers.AddResult(Result.Win);
            FinnHarps.AddResult(Result.Loss);
            FinnHarps.AddResult(Result.Draw);
            GalwayUnited.AddResult(Result.Win);
            Dundalk.AddResult(Result.Loss);

            Console.WriteLine("{0,-15}{1,-7}{2,-7}{3,-7}{4,-7}{5,-7}", "NAMES", "POINTS", "WINS", "DRAWS", "LOSSES", "PLAYED");

            foreach (Team team in teamList)
            {
                Console.WriteLine(team.DisplayTeamTable());
            }

            teamList.Sort();

            teamList.Reverse();

            Console.WriteLine();

            Console.WriteLine("{0,-15}{1,-7}{2,-7}{3,-7}{4,-7}{5,-7}", "NAMES", "POINTS", "WINS", "DRAWS", "LOSSES", "PLAYED");

            foreach (Team team in teamList)
            {
                Console.WriteLine(team.DisplayTeamTable());
            }

            Console.WriteLine();

            SligoRovers.Players.Add(new Player()
            {
                Name = "Ed Mcginty", Position = "GoalKeeper"
            });
            SligoRovers.Players.Add(new Player()
            {
                Name = "Jon Tron", Position = "Striker"
            });
            SligoRovers.Players.Add(new Player()
            {
                Name = "Dimitar Dimadome", Position = "Midfield"
            });

            Console.WriteLine("Sligo Rovers Teamsheet");
            foreach (Player player in SligoRovers.Players)
            {
                Console.WriteLine($"{player.Name} - {player.Position}");
            }
        }