Example: Depreciation - French Accounting System
In this example, the depreciation for the second accounting period is calculated for an asset.
import com.imsl.finance.*;
import java.text.*;
import java.util.*;
public class amorlincEx1 {
static final DateFormat dateFormat =
DateFormat.getDateInstance(DateFormat.SHORT, Locale.US);
static private GregorianCalendar parse(String s) throws ParseException {
GregorianCalendar cal = new GregorianCalendar();
cal.setTime(dateFormat.parse(s));
return cal;
}
public static void main(String args[]) throws ParseException {
double cost = 2400.;
GregorianCalendar issue = parse("11/1/92");
GregorianCalendar firstPeriod = parse("11/30/93");
double salvage = 300.;
int period = 2;
double rate = .15;
DayCountBasis dcb = DayCountBasis.BasisNASD;
double amorlinc = Bond.amorlinc(cost, issue, firstPeriod,
salvage, period, rate, dcb);
System.out.println("The depreciation for the second accounting " +
"period is " +amorlinc);
}
}
Output
The depreciation for the second accounting period is 360.0
Link to Java source.