Class Calculator
- Namespace
- CalculatorLibrary
- Assembly
- CalculatorLibrary.dll
Performs basic arithmetic operations on integers.
public class Calculator
- Inheritance
-
Calculator
- Inherited Members
Remarks
This is the sample class the template ships with. When you start your own project, replace it
(and CalculatorCli) with your own domain classes — see
docs/guide/from-topic-to-project.en.md for the step-by-step walkthrough.
Methods
Add(int, int)
Adds two integers.
public int Add(int a, int b)
Parameters
Returns
- int
The sum of
aandb.
Divide(int, int)
Divides one integer by another using integer (truncating) division.
public int Divide(int a, int b)
Parameters
Returns
- int
The integer quotient of
adivided byb.
Exceptions
- DivideByZeroException
Thrown when
bis zero.
Multiply(int, int)
Multiplies two integers.
public int Multiply(int a, int b)
Parameters
Returns
- int
The product of
aandb.
Subtract(int, int)
Subtracts one integer from another.
public int Subtract(int a, int b)
Parameters
Returns
- int
The result of
aminusb.