Пример #1
0
        public override string ToString()
        {
            StringBuilder report = new StringBuilder();

            GrazingFields.ForEach(gf => report.Append(gf));

            ChickenHouses.ForEach(ch => report.Append(ch));

            DuckHouses.ForEach(dh => report.Append(dh));

            PlowedFields.ForEach(pf => report.Append(pf));

            NaturalFields.ForEach(nf => report.Append(nf));

            return(report.ToString());
        }
Пример #2
0
        public override string ToString()
        {
            double TotalMeat = 0;

            foreach (GrazingField gf in GrazingFields)
            {
                TotalMeat += gf.Meat;
            }
            StringBuilder report = new StringBuilder();

            GrazingFields.ForEach(gf => report.Append(gf));
            ChickenHouses.ForEach(ch => report.Append(ch));
            DuckHouses.ForEach(dh => report.Append(dh));
            NaturalFields.ForEach(dh => report.Append(dh));
            PlowedFields.ForEach(dh => report.Append(dh));

            report.Append($"Total Meat Produced: {TotalMeat}kg");


            return(report.ToString());
        }