Untitled
unknown
plain_text
4 years ago
1.1 kB
5
Indexable
fun main() {
println("Hello! Please press 1 to enter car details, and press 2 to get existing cars chassis")
val userInput = readLine()!!.toInt()
//entering car details here:
if (userInput == 1) {
val carType: String = readLine()!!
val carModel: String = readLine()!!
val carModelDate: String = readLine()!!
val price: Int = readLine()!!.toInt()
val kilos: Int = readLine()!!.toInt()
val chassis: String = readLine()!!
val listcode = arrayListOf<String>()
listcode.addAll(listOf("Car Type: $carModel, Car Model:$carType, Car Model Date: $carModelDate,Car Price: $price,Kilos: $kilos, Chassis: $chassis"))
println(listcode)
}
//inquiring about car chassis
else {
val hashmap: HashMap<String, Any?> = HashMap<String, Any?>()
hashmap.put("Ford Mustang", "1XDFSEFC")
hashmap.put("Toyota Camry", "2CKHKDJH")
hashmap.put("Honda Accord", "2CKHKDJH")
print(hashmap)
}
}
Editor is loading...