שאלון 899381 מדעי המחשב ב' קיץ תשע"ו שאלה מספר שלוש פתרון בשפת C#

סעיף א' נבנה פעולה בונה למחלקה Game:

public Game(string gameName, int numPlayers, bool isWater)

{

        this.gameName =  gameName;

        this.numPlayers =  numPlayers;

        this.isWater = isWater;

}

סעיף ב' (1)- נבנה את כותרת המחלקה Country ואת התכונות שלה

public class Country{

        private string countryName;

        private Game []  games;

        

}

סעיף ב' (2)- נבנה פעולה בונה

public Country (string countryName){

        this.countryName = countryName;

        games = new Game[43];

}

סעיף ב' (3)

public bool IsPlaying(string gameName)

{

                for(int i=0; i<games.Length;i++)

                {

                        //        if(games[i]!=null && games[i].GetGameName()==(gameName) )

                        if(games[i]!=null && games[i].GetGameName().Equals(gameName)  )

                                return true;

                }

        return false;

}