// Yuck... private int TotalLiters(IEnumerable <ShippingBox> collection) { ShippingBoxes boxes = new ShippingBoxes(); foreach (ShippingBox aBox in collection) { boxes.AddOneBox(aBox); } return(boxes.TotalVolumeInLiters()); }
public void GenerateShippingBoxReport(ShippingBoxes boxes) { MakeRoom(); MakeHeader("SHIPPING BOXES"); Console.Write("MATERIAL".PadRight(20)); Console.Write("WIDTH x HEIGHT x DEPTH".PadRight(30)); Console.Write("MAX. WEIGHT".PadRight(30)); Console.WriteLine(); foreach (ShippingBox box in boxes.AllBoxes()) { Console.Write($"{box.Material}".PadRight(20)); Console.Write($"{box.Width} x {box.Height} x {box.Depth}".PadRight(30)); Console.Write($"(Max. {box.MaxWeight:F3} kgs.)".PadRight(30)); Console.WriteLine(); } MakeFooter(); Console.WriteLine($"Summary: a total of {boxes.NumberOfBoxes()} Shipping Boxes are available"); Console.WriteLine($" with a total volume of {boxes.TotalVolumeInLiters()} liters"); }