The Resistance is organizing ships to confront the Empire. R2D2 has a list with all the ships. The Resistance will attack only if all the ships have the same ammunition. Please complete the ship definition to help R2D2.
Computer scienceProgramming languagesKotlinObject-oriented programmingObject-oriented programming usage
hashCode and equals
The Empire strikes back
Report a typo
Sample Input 1:
Ford-11 Bismarck-20 Titanic-34 HMS-44Sample Output 1:
falseWrite a program in Kotlin
// complete the definition of the ship
class Ship(val name: String, val ammunition: Int) {
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.