Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner
- var asset: Double? = null
- var estimation: Double? = null
- var start: Int? = null
- var end: Int? = null
- var texts = Scanner(System.`in`)
- fun main() {
- println("Depreciation : Straight Line Method")
- print("Cost of Bought: ")
- asset = texts.nextDouble()
- println("Period of Depreciation(Year): ")
- print("Begin of Year (Integer): ")
- start = texts.nextInt()
- print("End of Year (Integer): ")
- end = texts.nextInt()
- print("Residual value(Float): ")
- estimation = texts.nextDouble()
- StraightLine(asset!!, start!!, end!!, estimation!!)
- }
- fun StraightLine(asset: Double, start: Int, end: Int, estimation: Double): Double {
- if (asset > 0 && start > 0 && end > 0) {
- var depreciation: Double = ((asset - estimation) / end)
- println(" Depreciation/ Year : ${depreciation.toLong()}")
- println("|Year| Amount - Accummulation = Resid |")
- } else {
- print(" Minimal Integer: 1")
- }
- var accummulation: Double = (start.toDouble() / end.toDouble()) * (asset - estimation)
- var resid: Double = asset - accummulation
- println("$start ${asset.toLong()} - ${accummulation.toLong()} = ${resid.toLong()}")
- return resid
- }
- // METHOD(FUNCTION HAS RETURN)
- // 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