Cleanup classes.

This commit is contained in:
aj
2018-05-31 22:26:55 -04:00
parent c3f24df75e
commit 8967aa8b55
5 changed files with 102 additions and 90 deletions

48
CutToLength/Bin.cs Normal file
View File

@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
namespace CutToLength
{
public class Bin
{
public List<BinItem> Items;
public Bin(double length)
{
Items = new List<BinItem>();
Length = length;
}
public double Spacing { get; set; }
public double Length { get; set; }
public double UsedLength
{
get
{
return Items.Sum(i => i.Length) + Spacing * Items.Count;
}
}
public double RemainingLength
{
get { return Length - UsedLength; }
}
public double Utilization
{
get { return (UsedLength / Length * 100.0); }
}
public override string ToString()
{
return string.Format(
"Length: {0}\", {1}\" remaining, {2} items, {3}% utilization",
Math.Round(Length, 4),
Math.Round(RemainingLength, 4),
Items.Count,
Math.Round(Utilization, 2));
}
}
}