Esempio n. 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.");
        }
Esempio n. 2
0
 public bool Fits(IRoundPeg roundPeg)
 {
     if (radius > roundPeg.GetRadius())
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Esempio n. 3
0
 public bool fits(IRoundPeg peg)
 {
     return(fits(peg.getRadius()));
 }
Esempio n. 4
0
 public bool Fits(IRoundPeg roundPeg)
 {
     return(roundPeg.Radius <= Radius);
 }
Esempio n. 5
0
        static bool IsHoleFit(IRoundPeg roundPeg)
        {
            int holeRadius = 4;

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