Setting a User Input to a Double (Or a Specific Data Type)

Try this instead which checks that what you’re entering is a valid number and, if it isn’t, asks you to reinput it:

    var originalTotal: Double?

    do {
       print("Enter the original total : ")
       originalTotal  = readLine()!!.toDoubleOrNull()
       if (originalTotal == null) println("Not a valid number, try again")
    }
    while (originalTotal == null)

    var tip = 0.15 * originalTotal
    println("Your tip is : $tip")
    var total = originalTotal + tip
    println("Your total is : $total")