desislava_topuzakova

Untitled

May 6th, 2021
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. using Arrays;
  2. using System;
  3. using System.Collections.Generic;
  4. public class Program
  5. {
  6. public static void Main()
  7. {
  8. Team team = new Team("Chelsea");
  9. int countPlayers = int.Parse(Console.ReadLine());
  10.  
  11. for (int player = 1; player <= countPlayers; player++)
  12. {
  13. string data = Console.ReadLine();//"Asen Ivanov 20 2200"
  14. string[] splittedData = data.Split(" ");
  15. //["Asen", "Ivanov", "20", "2200"]
  16. string firstName = splittedData[0]; //"Asen"
  17. string lastName = splittedData[1]; //"Ivanov"
  18. int age = int.Parse(splittedData[2]); //"20" -> 20
  19. double salary = double.Parse(splittedData[3]); // "2200" -> 2200
  20.  
  21. Person person = new Person(firstName, lastName, age, salary);
  22. team.AddPlayer(person);
  23.  
  24. }
  25.  
  26. Console.WriteLine($"First team have {team.FirstTeam.Count} players");
  27. Console.WriteLine($"Reserve team have {team.ReserveTeam.Count} players");
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment