# Java Program to Calculate Depreciation

In the previous article, we have seen Java Program to Calculate Distance Between Two Points

In this article we will see how we can calculate depreciation using Java programming language.

## Java Program to Calculate Depreciation

Before jumping into the program directly let’s know first what is this depreciation and how we calculate depreciation.

Depreciation:

Depreciation refers to the decrease of price of an product/asset over time. As we know every product/asset has it’s own life span. So, during it’s life span with the pass of time it’s value reduces due to use, wear and tear.

Let’s see different ways to calculate depreciation.

### Method-1: Java Program to Calculate Depreciation By Using Static Input Value

Approach:

• Declare value of asset cost, year, depreciation percentage.
• Calculate cost of asset after depreciation using formula ((100-depreciation_percent)*value)/100.

Program:

class Main
{
public static void main(String arg[])
{
//variables declared
long asset_cost, depreciation_percent, year, value;
//initial asset cost
asset_cost=10000;
//depreciation percent
depreciation_percent=10;
//years of product
year=3;
value=asset_cost;
//calculating cost after depreciation
for(int i=0;i<year;i++)
{
value=((100-depreciation_percent)*value)/100;
}
System.out.println("Before depreciation value was = "+asset_cost);
System.out.println("After depreciation value is = "+value);

}
}
Output:

Before depreciation value was = 10000
After depreciation value is = 7290

### Method-2: Java Program to Calculate Depreciation By Using User Input Value

Approach:

• Take user input of value of asset cost, year, depreciation percentage.
• Calculate cost of asset after depreciation using formula ((100-depreciation_percent)*value)/100.

Program:

import java.util.*;

class Main
{
public static void main(String arg[])
{
//Scanner class object created
Scanner sc=new Scanner(System.in);
//variables declared
long asset_cost, depreciation_percent, year, value;
//initial asset cost
System.out.println("Enter initial amount of asset: ");
asset_cost=sc.nextInt();
//depreciation percent
System.out.println("Enter percentage depreciation: ");
depreciation_percent=sc.nextInt();
//current year of product
System.out.println("Enter number of years: ");
year=sc.nextInt();
value=asset_cost;
//calculating cost after depreciation
for(int i=0;i<year;i++)
{
value=((100-depreciation_percent)*value)/100;
}
System.out.println("Before depreciation value was = "+asset_cost);
System.out.println("After depreciation value is = "+value);

}
}
Output:

Enter initial amount of asset:
10000
Enter percentage depreciation:
10
Enter number of years:
3
Before depreciation value was = 10000
After depreciation value is = 7290

Our website provided core java programs examples with output aid beginners and expert coders to test their knowledge gap and learn accordingly.

Test Yourself:

1. Calculate Depreciation Of Value In Java?
2. Program To Calculate Depreciation In Java?
3. How to calculate depreciation on fixed assets?
4. What are the methods for calculating depreciation?
5. How do you calculate depreciation?
6. Percentage Calculator In Java?
7. Java program to calculate cgpa?
8. Java program to calculate compound interest using for loop?
9. Calculate batting average in java?
10. Calculate depreciation of value?
11. Program to calculate cgpa percentage in java
12. Compound interest program in java
13. C program to calculate depreciation
14. Cava program to calculate depreciation

Related Java Programs: