/**
 * A carpenter is calculating their estimate for a project based on the number of hours they will work
 * and their hourly rate. The estimate is also affected by the selection of materials. Complete the code
 * below to calculate the total estimate including materials cost.
 *
 * @param hours integer representing the number of hours the carpenter will work
 * @param rate float representing the hourly rate of the carpenter
 * @return total_estimate float representing the total estimate of the project including materials cost
 */
fun calculateCarpenterEstimate(hours: Int, rate: Float): Float {

    println("Enter materials cost: $")
    val materials = readLine()
    val materialsCost = materials?.toFloat() ?: 0.0f

    val markup = when {
        materialsCost < 500 -> 1.1f
        materialsCost < 1000 -> 1.2f
        materialsCost < 2000 -> 1.3f
        else -> 1.4f
    }

    val totalEstimate = (hours * rate) + (materialsCost * markup)
    return totalEstimate
}
/**
 * A carpenter is calculating their estimate for a project based on the number of hours they will work
 * and their hourly rate. The estimate is also affected by the selection of materials. Complete the code
 * below to calculate the total estimate including materials cost.
 *
 * @param hours integer representing the number of hours the carpenter will work
 * @param rate float representing the hourly rate of the carpenter
 * @return total_estimate float representing the total estimate of the project including materials cost
 */
fun calculateCarpenterEstimate(hours: Int, rate: Float): Float {
/**
 * A carpenter is calculating their estimate for a project based on the number of hours they will work
 * and their hourly rate. The estimate is also affected by the selection of materials. Complete the code
 * below to calculate the total estimate including materials cost.
 *
 * @param hours integer representing the number of hours the carpenter will work
 * @param rate float representing the hourly rate of the carpenter
 * @return total_estimate float representing the total estimate of the project including materials cost
 */
fun calculateCarpenterEstimate(hours: Int, rate: Float): Float {

    println("Enter materials cost: $")
    val materials = readLine()
    val materialsCost = materials?.toFloat() ?: 0.0f

    val markup = when {
        materialsCost < 500 -> 1.1f
        materialsCost < 1000 -> 1.2f
        materialsCost < 2000 -> 1.3f
        else -> 1.4f
    }

    val totalEstimate = (hours * rate) + (materialsCost * markup)
    return totalEstimate
}