Example: Depreciation - Variable Declining Balance

The depreciation between the 10th and 15th year of an asset with a life of 15 years, an initial cost of $25000 and a salvage value of $5000 is computed. The variable-declining balance method is used.
import com.imsl.finance.*;
import java.text.NumberFormat;

public class vdbEx1 {
    public static void main(String args[]) {
        double cost = 25000;
        double salvage = 5000;
        int life = 15;
        int start = 10;
        int end = 15;
        double factor = 2.;
        boolean	no_sl = false;
        
        double vdb = Finance.vdb(cost, salvage, life, start, end,
        factor, no_sl);
        System.out.println("The depreciation allowance between the " +
        "10th and 15th year is " +
        NumberFormat.getCurrencyInstance().format(vdb));
    }
}

Output

The depreciation allowance between the 10th and 15th year is $976.69
Link to Java source.