/* ImportantBirthdays.kt Copyright (c) Kari Laitinen http://www.naturalprogramming.com 2020-10-31 File created. If you want to insert a dollar sign into a Kotlin string, you need to write it like "${'$'}" */ import java.time.LocalDate fun main() { print( "\n Type in your date of birth as YYYY-MM-DD" + "\n Please, use four digits for the year" + "\n and two digits for month and day: " ) val date_of_birth_as_string = readLine()!! val date_of_birth = LocalDate.parse( date_of_birth_as_string ) print( String.format( "\n You were born on a %tA", date_of_birth ) ) print( "\n Here are your days to celebrate. You are\n" ) var years_to_celebrate = 10L while ( years_to_celebrate < 80 ) { val date_to_celebrate = date_of_birth.plusYears( years_to_celebrate ) print( String.format( "\n %1${'$'}d years old on %2${'$'}tF (%2${'$'}tA)", years_to_celebrate, date_to_celebrate ) ) years_to_celebrate = years_to_celebrate + 10 } print( "\n\n" ) }