samples/composition/src-api2.0/api/Arithmetica.java
changeset 20 afae7be94b25
parent 17 af005434d27f
child 23 e043859ed1ca
     1.1 --- a/samples/composition/src-api2.0/api/Arithmetica.java	Sat Jun 14 09:51:04 2008 +0200
     1.2 +++ b/samples/composition/src-api2.0/api/Arithmetica.java	Sat Jun 14 09:51:05 2008 +0200
     1.3 @@ -1,8 +1,10 @@
     1.4  package api;
     1.5  
     1.6 -/** Class to simplify arithmetical operations.
     1.7 +/** Class to simplify arithmetical operations, improved version to compute
     1.8 + * the sum for ranges.
     1.9   *
    1.10   * @author Jaroslav Tulach <jtulach@netbeans.org>
    1.11 + * @version 2.0
    1.12   */
    1.13  public class Arithmetica {
    1.14      public int sumTwo(int one, int second) {
    1.15 @@ -18,6 +20,6 @@
    1.16      }
    1.17      
    1.18      public int sumRange(int from, int to) {
    1.19 -        return (from + to) * (from - to + 1) / 2;
    1.20 +        return (from + to) * (to - from + 1) / 2;
    1.21      }
    1.22  }