public int CalculateMetrics(Arithemetic objArithemetic) { switch (objArithemetic.OpertionType) { case Arithemetic.Options.Add: { return Add(objArithemetic); } case Arithemetic.Options.Sub: { return Sub(objArithemetic); } case Arithemetic.Options.Mul: { return Mul(objArithemetic); } default: return 0; } }
private int Sub(Arithemetic objArithemetic) { return objArithemetic.Operand1 - objArithemetic.Operand2; }
private int Mul(Arithemetic objArithemetic) { return objArithemetic.Operand1*objArithemetic.Operand2; }
private int Add(Arithemetic objArithemetic) { return objArithemetic.Operand1 + objArithemetic.Operand2; }