Created
August 18, 2019 07:53
-
-
Save jasongorman/69f6413e93d9f7d11804ae67aeddfcdf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun quote(width: Double, length: Double, pricePerSqrMtr: Double, roundUp: Boolean): Double { | |
return carpetPrice(pricePerSqrMtr, roundUp, roomArea(width, length)) | |
} | |
fun carpetPrice(pricePerSqrMtr: Double, roundUp: Boolean, area: Double): Double { | |
val areaToPrice = if (roundUp) { | |
Math.ceil(area) | |
} else { | |
area | |
} | |
return pricePerSqrMtr * areaToPrice | |
} | |
fun roomArea(width: Double, length: Double): Double { | |
return width * length | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment