Example: Depreciation - Sum-of-years' Digits
The sum-of-years' digits depreciation for the 14th year of an asset with a life of 15 years, an initial cost of $25000 and a salvage value of $5000 is computed.
import com.imsl.finance.*;
import java.text.NumberFormat;
public class sydEx1 {
public static void main(String args[]) {
double cost = 25000;
double salvage = 5000;
int life = 15;
int per = 14;
double syd = Finance.syd(cost, salvage, life, per);
System.out.println("The depreciation allowance for the 14th year is " +
NumberFormat.getCurrencyInstance().format(syd));
}
}
Output
The depreciation allowance for the 14th year is $333.33
Link to Java source.