Improve your vehicle

Report a typo

Create a function fun printHorsePower() that prints the name of the Vehicle and the horsePower of the Engine in the following format: The <name> vehicle has <horsePower> horsepower.

So for a vehicle called Dixi with 20 horsepower, the output of printHorsePower should be:

The Dixi vehicle has 20 horsepower.
Write a program in Kotlin
class Vehicle(val name: String) {
inner class Engine(val horsePower: Int) {
fun start() {
println("RRRrrrrrrr....")
}

// create function printHorsePower()
}
}
___

Create a free account to access the full topic