Proxy > Gmail Facebook Yahoo!

27. Write a program to determine the salvage value of an item when the purchase price, years of service and the annual depreciation are given.




import java.util.*;
public class CalcDepreciation {
 
 
  public static void main(String[] args)
  {
    Scanner scan=new Scanner(System.in);
    System.out.print("Enter Purchase Price (p):");
    double p=scan.nextDouble();
    System.out.print("Enter years of service (y):");
    int y=scan.nextInt();
    System.out.print("Enter annual depreciation(d):");
    double d=scan.nextDouble();
    double salvageValue= p - d*y;
    System.out.println("Salvage Value ="+salvageValue);
  }
 
}


Responses

0 Respones to "27. Write a program to determine the salvage value of an item when the purchase price, years of service and the annual depreciation are given."


Send mail to your Friends.  

Expert Feed

 
Return to top of page Copyright © 2011 | My Code Logic Designed by Suneel Kumar