Example #1
0
        public Tube Create(double projectLength, double projectWeight, string type)
        {
            Tube t = null;

            switch (type)
            {
            case "CastIron": t = new CastIronTube(); break;

            case "Pvc": t = new PvcTube(); break;

            case "Steel": t = new SteelTube(); break;

            default: throw new ArgumentException("Not recognized tube type!");
            }

            t.ProjectLength = projectLength;
            t.ProjectWeight = projectWeight;

            t.RealLength = t.ProjectLength * (1 + ((_r.NextDouble() - 0.5) / 25));
            t.RealWeight = t.ProjectWeight * (1 + ((_r.NextDouble() - 0.5) / 10));

            return(t);
        }
Example #2
0
 public void Visit(PvcTube tube)
 {
     tube.Color = "Orange";
 }