Exemple #1
0
        /// <summary>
        /// Inserts any <see cref="IRoundPeg"/> implementation into the hole.
        /// </summary>
        public void Insert(IRoundPeg peg)
        {
            if (peg.Radius > this.Radius)
            {
                throw new Exception(message: "You cannot insert an object with larger radius than the hole!");
            }

            Console.WriteLine($"You have inserted a peg with radius {peg.Radius} into the hole successfully.");
        }
Exemple #2
0
 public bool Fits(IRoundPeg roundPeg)
 {
     if (radius > roundPeg.GetRadius())
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemple #3
0
 public bool fits(IRoundPeg peg)
 {
     return(fits(peg.getRadius()));
 }
Exemple #4
0
 public bool Fits(IRoundPeg roundPeg)
 {
     return(roundPeg.Radius <= Radius);
 }
        static bool IsHoleFit(IRoundPeg roundPeg)
        {
            int holeRadius = 4;

            return(roundPeg.GetRadius() <= holeRadius);
        }