Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // FUNCTION(PARAMETER)
- import java.util.Scanner;
- import java.lang.*;
- public class func_depreciation {
- public static double Asset, Estimation;
- public static int Period, Start, End;
- public static void main(String[] args) {
- Scanner text = new Scanner(System.in);
- System.out.println("Depreciation : Straight Line Method");
- System.out.print("Cost of Bought: ");
- Asset = text.nextDouble();
- System.out.println("Period of Depreciation(Year): ");
- System.out.print("Period (Integer): ");
- Period = text.nextInt();
- System.out.print("Begin of Year (Integer): ");
- Start = text.nextInt();
- System.out.print("End of Year (Integer): ");
- End = text.nextInt();
- System.out.print("Residual value(Float): ");
- Estimation = text.nextDouble();
- StraightLine(Asset, Period, Start, End, Estimation);
- }
- private static void StraightLine(double Asset, int Period, int Start, int End, double Estimation) {
- if (Asset > 0 && Period > 0 && Start > 0 && End > 0) {
- double depreciation = ((Asset - Estimation) / Period);
- System.out.println(String.format(" Depreciation/ Year : %,.2f", depreciation));
- System.out.println("| Year | Amount - Accummulation = Resid |");
- } else {
- System.out.println(" Minimal Integer: 1");
- }
- for (int x = Start; x <= End; x++) {
- double fraction = ((double) x) / ((double) Period);
- double accummulation = fraction * (Asset - Estimation);
- double resid = Asset - accummulation;
- System.out.println(String.format("%d %,.2f - %,.2f = %,.2f", x, Asset, accummulation, resid));
- }
- }
- }
- // Pray 4 Uyghur: https://bylinetimes.com/2020/08/24/death-is-everywhere-millions-more-uyghurs-missing/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement