我正在编写一个桌面应用程序,用于计算资产的月折旧和累计。
累积基于用户指定的月数。 因此,如果用户指定了12个月,则应累计超过这些月份。
此外,用户应该能够查看到目前为止每个月的累计值是否在指定的月份内。例如,如果我选择1月它应该给我1月的累计价值等等......
下面是一个示例代码
private void getAccumulation() {
try {
for (int row = 0; row <= 5; row++) {
double Cost_Of_Acquisition = 2000;
double Estimated_Residual_Value = 250;
int Estimated_Useful_Life = 5;
int depreciationMethod = 1;
System.out.println(" acquisition cost of asset = " + (int) Cost_Of_Acquisition);
System.out.println(" salvage value = " + (int) Estimated_Residual_Value);
System.out.println(" number of months = " + Estimated_Useful_Life);
System.out.println(" depreciation method = " + depreciationMethod);
for (int y = 1; y <= 5; y++) {
switch (depreciationMethod) {
case 1:
System.out.println(" straight line depreciation ");
double StraightLineDepreciation = ((Cost_Of_Acquisition - Estimated_Residual_Value) / Estimated_Useful_Life);
double AccumulatedDeprecaitionSL = (StraightLineDepreciation * y);
System.out.println("Asset number " + "1" + " uses straight line depreciation");
System.out.println(" depreciation charge for asset number " + "1" + " in month " + y + "=" + StraightLineDepreciation);
System.out.println("accumulated depreciation is " + AccumulatedDeprecaitionSL);
break;
case 2:
System.out.println(" sum of months digits depreciation ");
int SumofMonths = (0);
break;
}
}
}
}
}