home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2005 June (DVD) / DPPRO0605DVD.iso / dotNETSDK / SETUP.EXE / netfxsd1.cab / math_cs_2________.3643236F_FC70_11D3_A536_0090278A1BB8 < prev    next >
Encoding:
Text File  |  2001-08-21  |  901 b   |  36 lines

  1. //==========================================================================
  2. //  File:        math.cs
  3. //
  4. //==========================================================================
  5. using System;
  6.  
  7. [assembly: System.Reflection.AssemblyVersion("1.0.0.0")]
  8. [assembly: System.Reflection.AssemblyKeyFile("WorldCalcKey.snk")]
  9.  
  10. namespace Demo.Localize.Math
  11. {
  12.  
  13.    public class InvalidFormulaException : ApplicationException { }
  14.  
  15.    public class IntegerMath
  16.    {
  17.         public String GetResult(Int32 arg1, Char op, Int32 arg2)
  18.         {
  19.             switch(op)
  20.             {
  21.                 case '+':
  22.                     return String.Format("{0:###0}", arg1 + arg2);
  23.                 case '-':
  24.                     return String.Format("{0:###0}", arg1 - arg2);
  25.                 case '/':
  26.                     return String.Format("{0:###0}", arg1 / arg2);
  27.                 case '*':
  28.                     return String.Format("{0:###0}", arg1 * arg2);
  29.                 default:
  30.                     throw new InvalidFormulaException();
  31.             }
  32.         }
  33.  
  34.    }
  35.  
  36. }