# A method to calculate monthly depreciation

• 10-30-2013, 04:16 PM
bankTechy
A method to calculate monthly depreciation
I have written this method to calculate the monthly depreciation based the entry of the Cost_Of_Acquisition,Estimated_Residual_Value,Estim ated_Useful_Life .
but it outputs soo many errors and i can't seem to understand where the problem is. Any help or direction will be appreciated:(handshake):

Code:

``` private void getAccumulation(){       double Monthly_Depreciation;       double Cost_Of_Acquisition = Integer.parseInt(txt_coa.getText());       double Estimated_Residual_Value = Integer.parseInt(txt_erv.getText());       int Estimated_Useful_Life = Integer.parseInt(eul.getText());             try{             Monthly_Depreciation = (Cost_Of_Acquisition - Estimated_Residual_Value)/Estimated_Useful_Life;                                                 System.out.print(Monthly_Depreciation);                                         }catch(Exception e){         JOptionPane.showMessageDialog(null, e);        }               }```
• 10-30-2013, 04:21 PM
PhHein
Re: A method to calculate monthly depreciation
Post the exact error messages you get. Per coding conventions variables start with lower case letters.
• 10-30-2013, 05:10 PM
bankTechy
Re: A method to calculate monthly depreciation
the error it gives is related to this part of the code
double Monthly_Depreciation;
double Cost_Of_Acquisition = Integer.parseInt(txt_coa.getText());
double Estimated_Residual_Value = Integer.parseInt(txt_erv.getText());
int Estimated_Useful_Life = Integer.parseInt(eul.getText());

the whole idea is let the user enter the values manually on a form the when he or she clicks a button it does the calculation and gives the user the output.
i hope u get what am trying to do?
• 10-30-2013, 05:12 PM
gimbal2
Re: A method to calculate monthly depreciation
So when someone asks you "Post the exact error messages you get", you then go ahead and do exactly not that.