I’m really close to completing https://www.codecademy.com/courses/learn-kotlin/projects/kotlin-animal-sanctuary
But I’m getting the following error messages, I’ve googled it, read every reference I can find on github and stackoverflow, but still getting the same results, thanks in advance for any feedback.
Sanctuary.kt:51:70: error: unexpected tokens (use ‘;’ to separate expressions on the same line)
println(“Great job completing your responsibilities on time.”) else if (timeSpent >= totalShiftTime && responsibilitiesComplete == responsibilities.size) {
Sanctuary.kt:52:59: error: unexpected tokens (use ‘;’ to separate expressions on the same line)
println(“Responsibilities complete with overtime.”) else {
Here is my code:
fun main() {
// Write your code below 🏞
var responsibilities = listOf("feed the chimps", "play a random game", "conduct a health check on Foxie")
var responsibilitiesComplete = 0
var timeSpent = 0
val totalShiftTime = 4
var foxiesHealthCheck = mutableMapOf<String, Any?>()
var chimpsHaveEaten = mutableMapOf("Bonnie" to false, "Jubilee" to false, "Frodo" to false, "Foxie" to false)
println("First, ${responsibilities[0]}")
println("Feeding Bonnie...")
chimpsHaveEaten["Bonnie"] = true
println("Feeding Jubilee...")
chimpsHaveEaten["Jubilee"] = true
println("Feeding Frodo...")
chimpsHaveEaten["Frodo"] = true
println("Feeding Foxie...")
chimpsHaveEaten["Foxie"] = true
timeSpent++
responsibilitiesComplete++
println("All chimps have now been fed! You've completed $responsibilitiesComplete / ${responsibilities.size} responsibilities.")
println("\nNext, ${responsibilities[1]}.")
val games = mutableSetOf("tug-of-war with a blanket", "catch and throw", "number game")
val randomGame = games.random()
println(randomGame)
timeSpent++
responsibilitiesComplete++
println("Each chimp has now played a game of $randomGame! You've completed $responsibilitiesComplete / ${responsibilities.size} responsibilities.")
println("Next, ${responsibilities[2]}")
foxiesHealthCheck.put("temperature", 37.2)
foxiesHealthCheck.put("mood", "happy")
println("Foxie has a temperature of ${foxiesHealthCheck["temperature"]} and is feeling ${foxiesHealthCheck["mood"]}.")
timeSpent++
responsibilitiesComplete++
println("Youve now completed $responsibilitiesComplete / ${responsibilities.size} responsibilities.")
if (timeSpent <= totalShiftTime && responsibilitiesComplete == responsibilities.size) {
println("Great job completing your responsibilities on time.") else if (timeSpent >= totalShiftTime && responsibilitiesComplete == responsibilities.size) {
println("Responsibilities complete with overtime.") else {
println("Responsibilities not complete and took extra time.")
}
}
}
}