using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace WSUniversalLib { public class Calculation { public static int GetQuantityForAgent(int agentType, int materialType, int count, float width, float length) { double[] matKoef = { 0, 0.1, 0.17, 0.26 }; double[] prodKoef = { 0, 1.8, 3.2, 4.1 }; if (agentType <= 0 || materialType <= 0 || count <= 0 || width <= 0 || length <= 0) { return -1; } try { int matCount = (int)Math.Ceiling(count * width * length * prodKoef[agentType] / matKoef[materialType]); return matCount; } catch { return -1; } } } }