Untitled
unknown
plain_text
3 years ago
1.7 kB
3
Indexable
Never
fun main(args: Array<String>) { var carname = arrayListOf<String>() var carmodel = arrayListOf<String>() var cardate = arrayListOf<String>() var carkilo = arrayListOf<String>() var carnumber = arrayListOf<String>() var hashm = hashMapOf<String,String>() var kilo = Regex("\\d{2,25}") var year = Regex("\\d{4}") val name_EX = Regex("[a-zA-Z]{2,25}") var exit = 1 while ( exit != 0 ){ var name = "" var date = "" var kilom = "" println("enter the Car name . " ) while (name.matches(name_EX) == false) { name = readLine()!!.toString() if (!name_EX.matches(name)) println("enter a correct name !!") } carname.add(name) println("enter the Car Model . " ) carmodel.add(readLine()!!) println("enter the Car made date . " ) while (year.matches(date) == false) { date = readLine()!!.toString() if (!year.matches(date)) println("enter a correct date ex:2012-2020 !!") } cardate.add(date) println("enter the Car kilometer . " ) while (kilo.matches(kilom) == false) { kilom = readLine()!!.toString() if (!kilo.matches(kilom)) println("enter a correct kilometer !!") } carkilo.add(kilom) println("enter the Car number . " ) hashm.put(readLine()!!, name) println("PRESS 0 TO STOP\nANY KEY TO CONTINUE") exit = readLine()!!.toInt() } }