View Javadoc

1   package com.arcmind.jsfquickstart.model;
2   
3   /***
4    * Calculator
5    *
6    * @author $author$
7    * @version $Revision$
8    */
9   public class Calculator {
10      //~ Methods ----------------------------------------------------------------
11  
12      /***
13       * add numbers.
14       *
15       * @param a first number
16       * @param b second number
17       *
18       * @return result
19       */
20      public int add(int a, int b) {
21          return a + b;
22      }
23  
24      /***
25       * multiply numbers.
26       *
27       * @param a first number
28       * @param b second number
29       *
30       * @return result
31       */
32      public int multiply(int a, int b) {
33          return a + b;
34      }
35  
36      /***
37       * divide numbers.
38       *
39       * @param a first number
40       * @param b second number
41       *
42       * @return result
43       */
44      public int divide(int a, int b) {
45          if (b == 0) {
46              throw new ArithmeticException("Divide by zero");
47          }
48          return a / b;
49      }
50  }