15 lines
675 B
Kotlin
15 lines
675 B
Kotlin
package lab_4
|
||
|
||
class Furniture(val name: String, val material: String, val price: Int, private val length: Int, private val width: Int, private val height: Int) {
|
||
fun print(nameWidth: Int, materialWidth: Int, priceWidth: Int){
|
||
val printString = StringBuilder()
|
||
printString
|
||
// .append("Furniture stats: {")
|
||
.append("Name: ${this.name.padEnd(nameWidth)} ")
|
||
.append("Material: ${this.material.padEnd(materialWidth)} ")
|
||
.append("Price: ${(this.price.toString() + " cu").padEnd(priceWidth + 3)} ")
|
||
.append("Size: ${this.length}×${this.width}×${this.height}")
|
||
|
||
println(printString)
|
||
}
|
||
} |