Hey guys, I need help with this assignment in swift playground that looks interesting to me. I think it is very easy for junior developers. If anyone can do this, I would like him to send me the results in playgrounds so I could go step by step and see how it is done. Please, I am dying to see this, I am fresh Swift learner and I find this very interesting.
The text of the assigment is:
Description:
- The football team has a maximum of 22 registered players, of which three are goalkeepers.
- Players with an active red card or 3 yellow cards can not be registered for the match
- Up to 16 players can apply for the match, two of which are goalkeepers
- 11 players start the match, one of which is a goalkeeper
Player:
- Position in the team, one of the values: Goalkeeper, Defense, Midfielder, Attack
- Number of jerseys (can be any number from 1 to 22)
- The number of yellow cards in the range 0 to 3
- Does it have an active red card?
The team:
- Name
- List of players
- The Match
- The Match can start if there are two valid teams with the required number of players.
Data model - Create a simple data model that declares:
- Player Position: Goalkeeper, Defender, Midfielder, Attack
- Player
- The team
- Assignment
Write functions that do the following:
- creating one player
- creating a team: its name and all the players, where each player has a name, a jersey, a position, etc.
- readable printing of all parameters of an arbitrary player
- "Says" whether a particular player can participate in the match
- "Returns" the position of an arbitrary player
- displaying a list of all players in the team
- displaying the numbers and names of players that start the match
- (next to each player print the position in the team)
- Are there conditions for the match to start?
- Write a "main" program that invokes all previously written functions and gives an example of their use.
What is available:
- Variable and constants of any type
- Tuples
- Enumerations
- Array, Set, Dictionary
- Functions
- Everything needs to work and function in one Playground