Java 每月资产折旧

Java 每月资产折旧,java,netbeans,Java,Netbeans,我正在编写一个桌面应用程序,它将用于计算资产的每月折旧和累计 累计基于用户指定的月数。 因此,如果用户指定12个月,则应在这些月内累积 此外,用户应该能够查看指定月数内每个月的累积值。e、 g如果我选择一月,它应该给我一月的累计值,以此类推 挑战:第一个挑战是获取所有用户指定月份的累积值,第二个挑战是如何将此概念与我的j表单和数据库联系起来,因为我的代码可以工作,但如何将其融合到我的程序中是一个问题。 折旧方法:直线法 下面是一个示例代码 private void getAccumulatio

我正在编写一个桌面应用程序,它将用于计算资产的每月折旧和累计

累计基于用户指定的月数。 因此,如果用户指定12个月,则应在这些月内累积

此外,用户应该能够查看指定月数内每个月的累积值。e、 g如果我选择一月,它应该给我一月的累计值,以此类推

挑战:第一个挑战是获取所有用户指定月份的累积值,第二个挑战是如何将此概念与我的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;

                 }
             }
         }
     }
 }
private void getcontraction(){
试一试{

对于(int row=0;row您应该上会计课!请更具体地回答您的问题。请正确缩进代码,并使用大写的标准约定,以便代码可读。此代码有效!!但我希望用户通过使用文本字段手动插入值。这是一个问题。值为al准备好了,但我希望在程序运行时输入值。因此,当您输入成本、寿命、残值并单击“计算”按钮时,它会进行折旧和累加,并输出结果。