Giter VIP home page Giter VIP logo

week-02_hw_class_struct's Introduction

week-02_HW_CLASS_STRUCT

You Love football , and you want to create models for teams and their players. Follow the step to accomplish this task .

Create a struct Player . It has the following properties and function

  • name : String
  • height : Double
  • location : String
  • skillLevel : String
  • shirtNumber : Int
  • position : String
  • func describePlayer . This function should print a description of the player struct using the properties . example : "Player name is Ronaldo , he is 1.84 meters tall. His skill level is very high and playes in position left wing . His T-Shirt number is 4."

Create a class Team. It has the following properties and functions

  • name : String
  • players : [Player]
  • func describeTeam . This function prints " the team < name > has the following players: ". Then, using a loop on the array players , call the function player.describePlayer()

Now you want to model Real Madrid team using the Team class and add some players. Follow those steps:

  • Create 4 different players who play in Real Madrid FC
  • Create the team realMadrid using the class Team and initialize it using the 4 players you created in the last step
  • Call the function realMadrid.describeTeam()

Bonus

  • Create another 2 teams with players (maybe use your favorite football team) .
  • call the method describeTeam for each of them

week-02_hw_class_struct's People

Contributors

aqeel-aleid avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.