Exemplo n.º 1
0
        public override IValue[] Calculate(IValue[] inputs)
        {
            this.CheckInputs(inputs);

            var dimensionX = new FeetInchesDimension(TypeConverter.ToObject <double>(inputs[0].Value), TypeConverter.ToObject <double>(inputs[1].Value));
            var dimensionY = new FeetInchesDimension(TypeConverter.ToObject <double>(inputs[2].Value), TypeConverter.ToObject <double>(inputs[3].Value));

            var totalInchesX = GetTotalInches(dimensionX);
            var totalInchesY = GetTotalInches(dimensionY);

            var squareInches = totalInchesX * totalInchesY;

            var squareFeet = FromSquareInchesToSquareFeet(squareInches);

            return(this.CreateResults(squareFeet));
        }
Exemplo n.º 2
0
 private static double GetTotalInches(FeetInchesDimension dimension)
 {
     return(FromFeetToInches(dimension.Feet) + dimension.Inches);
 }