import java.io.*; public class years { public static void main (String[] args) throws IOException { BufferedReader myInput = new BufferedReader (new InputStreamReader (System.in)); String userchoice; int year; int f = 0; double cost, cost2; double accumalatedValue, bookValue; System.out.println (" What is the original cost of the item? "); userchoice = myInput.readLine(); cost = Double.parseDouble (userchoice); System.out.println (" What is the scrap/salvage value of the item? "); userchoice = myInput.readLine(); cost2 = Double.parseDouble (userchoice); System.out.println (" What is the approximate year durability? "); userchoice = myInput.readLine(); year = Integer.parseInt (userchoice); for (int i = year ; i >= 0 ; i--) f = f+i; accumalatedValue = cost - cost2 / f; System.out.println ("Total year " + f); System.out.println ("The total cost is:" + accumalatedValue); } }