samples/individualsamples/src/org/apidesign/samples/HundredPercentCoverage.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Fri, 03 Apr 2020 16:32:36 +0200
changeset 416 9ed8788a1a4e
permissions -rw-r--r--
Using HTTPS to download the libraries
jtulach@156
     1
package org.apidesign.samples;
jtulach@156
     2
jtulach@156
     3
public class HundredPercentCoverage {
jtulach@156
     4
    // BEGIN: hundred.percent
jtulach@156
     5
    private int sum = 10;
jtulach@156
     6
jtulach@156
     7
    public int add(int x) {
jtulach@156
     8
        sum += x;
jtulach@156
     9
        return sum;
jtulach@156
    10
    }
jtulach@156
    11
jtulach@156
    12
    public int percentageFrom(int howMuch) {
jtulach@156
    13
        return 100 * howMuch / sum;
jtulach@156
    14
    }
jtulach@156
    15
    // END: hundred.percent
jtulach@156
    16
}