Challenge 2: Operator Overloading for a Money Type — Solution data class Money(val cents: Int) : Comparable { operator fun plus(other: Money) = Money(cents + other.cents) override fun compareTo(other: Money): Int = cents.compareTo(other.cents) } fun main() { val price = Money(1999) val tax = Money(160) val total = price + tax println("Total: ${total.cents} cents") val budget = Money(2000) println("Over budget: ${total > budget}") } /* Output: Total: 2159 cents Over budget: true Notes: - operator fun plus(other: Money) makes "price + tax" call price.plus(tax) automatically, returning a new Money with the summed cents value. - compareTo is implemented by having Money implement Comparable (Course 1's generic-constraint pattern from Chapter 3) and overriding compareTo — Kotlin then maps >, <, >=, <= directly onto that single method, so "total > budget" works without any separate operator fun needed for ">" itself. - Both operators map onto operations that already have an obvious, intuitive meaning for a Money type — exactly the kind of case operator overloading is meant for. */