コード例 #1
0
ファイル: Kid.cs プロジェクト: sergio8311/kid-attraction
        public void Ride()
        {
            if (Money - AttractionSettings.GetAttractionsCost() >= 0)
            {
                Money = Money - AttractionSettings.GetAttractionsCost();
                LevelOfHappines++;
            }

            else
            {
                Console.WriteLine($"{Name} don't allowed to attraction, due to low balance {Money}");
            }
        }
コード例 #2
0
        public void IsKidAllowedToRide(bool isAllowed, Kid kid)
        {
            if (isAllowed)
            {
                kid.Ride();
                _cash = _cash + AttractionSettings.GetAttractionsCost();
            }

            else
            {
                kid.Cry();
            }
        }
コード例 #3
0
 static bool IsKidAllowed(Attractions attraction, Kid kid)
 {
     if (attraction == Attractions.Batman & kid.Height > AttractionSettings.GetMinimumHeightForBatman() & kid.Gender == Gender.Male)
     {
         return(true);
     }
     if (attraction == Attractions.Swan & kid.Gender == Gender.Female & (kid.Height > AttractionSettings.GetMinimumHeightForSwan() & kid.Height < AttractionSettings.GetMaximumHeightForSwan()))
     {
         return(true);
     }
     if (attraction == Attractions.Swan & kid.Gender == Gender.Male & kid.Height < AttractionSettings.GetMaximumHeightForSwan())
     {
         return(true);
     }
     if (attraction == Attractions.Pony)
     {
         return(true);
     }
     return(false);
 }