我正在编写一个桌面应用程序,用于计算资产的每月折旧和累积。
累积基于用户指定的月数。因此,如果用户指定 12 个月,则应在这些月内累积。
到目前为止,用户应该能够查看每个月的累积值,因为它是在指定的月数内。例如,如果我选择一月,它应该给我一月的累计值等等......
挑战:第一个挑战是获取所有用户指定月份的累积值第二个挑战是如何将此概念与我的 j 表单和我的数据库联系起来,因为我的代码有效,但如何将其融合到我的程序中是一个问题。
折旧方法:直线
下面是一个示例代码
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;
}
}
}
}
}