### Example: Depreciation - Double-Declining Balance Method

The depreciation of an asset with an initial cost of \$2500 and a salvage value of \$500 over a period of 2 years is calculated. A factor of 2 is used (the double-declining balance method).
```
import com.imsl.finance.*;
import java.text.NumberFormat;

public class ddbEx1 {

public static void main(String args[]) {
double cost = 2500;
double salvage = 500;
double factor = 2;
int life = 24;

for (int period = 1; period <= life; period++) {
double ddb = Finance.ddb(cost, salvage, life, period, factor);
System.out.println("For period " + period + "    ddb = "
+ NumberFormat.getCurrencyInstance().format(ddb));
}
}
}
```

#### Output

```For period 1    ddb = \$208.33
For period 2    ddb = \$190.97
For period 3    ddb = \$175.06
For period 4    ddb = \$160.47
For period 5    ddb = \$147.10
For period 6    ddb = \$134.84
For period 7    ddb = \$123.60
For period 8    ddb = \$113.30
For period 9    ddb = \$103.86
For period 10    ddb = \$95.21
For period 11    ddb = \$87.27
For period 12    ddb = \$80.00
For period 13    ddb = \$73.33
For period 14    ddb = \$67.22
For period 15    ddb = \$61.62
For period 16    ddb = \$56.48
For period 17    ddb = \$51.78
For period 18    ddb = \$47.46
For period 19    ddb = \$22.09
For period 20    ddb = \$0.00
For period 21    ddb = \$0.00
For period 22    ddb = \$0.00
For period 23    ddb = \$0.00
For period 24    ddb = \$0.00
```