Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // FUNCTION (PARAMETER)
- import java.util.Scanner
- var Asset: Double? = null
- var Estimation: Double? = null
- var Period: Int? = null
- var Start: Int? = null
- var End: Int? = null
- var text = Scanner(System.`in`)
- fun main() {
- println("Depreciation : Straight Line Method")
- print("Cost of Bought: ")
- Asset = text.nextDouble()
- println("Period of Depreciation(Year): ")
- print("Period (Integer): ")
- Period = text.nextInt()
- print("Begin of Year (Integer): ")
- Start = text.nextInt()
- print("End of Year (Integer): ")
- End = text.nextInt()
- print("Residual value(Float): ")
- Estimation = text.nextDouble()
- StraightLine(Asset!!, Period!!, Start!!, End!!, Estimation!!)
- }
- fun StraightLine(Asset: Double, Period: Int, Start: Int, End: Int, Estimation: Double) {
- if (Asset > 0 && Period > 0 && Start > 0 && End > 0) {
- var depreciation: Double = ((Asset - Estimation) / Period)
- println(" Depreciation/ Year : ${depreciation.toLong()}")
- println("|Year| Amount - Accummulation = Resid |")
- } else {
- print(" Minimal Integer: 1")
- }
- for (x in Start..End step 1) {
- var accummulation: Double = (x.toDouble() / Period.toDouble()) * (Asset - Estimation)
- var resid: Double = Asset - accummulation
- println("$x ${Asset.toLong()} - ${accummulation.toLong()} = ${resid.toLong()}")
- }
- }
- // Pray 4 Uyghur: https://bylinetimes.com/2020/08/24/death-is-everywhere-millions-more-uyghurs-missing/
Add Comment
Please, Sign In to add comment