1
1
Fork 0

Solutions update

This commit is contained in:
Svetlana Isakova 2020-12-14 22:23:26 +01:00
parent bca12e24f6
commit db7d99c254
8 changed files with 16 additions and 18 deletions

View File

@ -62,7 +62,7 @@ fun main() {
ID(name=b, id=LCcPJtUGh5),
ID(name=c, id=Acs5BzSj6m),
ID(name=d, id=gHrshDvhwc)
""".trimIndent()
"""
val bank = Bank("Jerry's Savings & Loan")
listOf(ID("Morty Smith"), ID("Beth Smith"),
ID("Summer Smith")).forEach {

View File

@ -12,4 +12,4 @@ class SumChars(text: String) {
fun main() {
SumChars("What?").sum eq 467
}
}

View File

@ -14,7 +14,7 @@ class Turbine(val id: Int) {
}
override fun toString() =
"Generator $id running: " +
"${::_generator.isInitialized}"
"${::_generator.isInitialized}"
}
class PowerPlant(nTurbines: Int = 4) {
@ -24,10 +24,8 @@ class PowerPlant(nTurbines: Int = 4) {
require(number in 0..turbines.size)
return turbines[number].generator
}
fun status() {
turbines.forEach {
trace(it.toString())
}
fun status() = turbines.forEach {
trace(it.toString())
}
}

View File

@ -6,17 +6,17 @@ files:
- offset: 231
length: 115
placeholder_text: ' = Generator(0) // TODO'
- offset: 413
- offset: 411
length: 31
placeholder_text: TODO()
- offset: 531
- offset: 529
length: 31
placeholder_text: TODO()
- offset: 609
- offset: 607
length: 73
placeholder_text: TODO()
- offset: 708
length: 51
- offset: 702
length: 47
placeholder_text: TODO()
- name: test/Tests.kt
visible: false

View File

@ -2,7 +2,7 @@
package operatorOverloadingExercise3
import atomictest.*
class Repository<T>(val initSize: Int = 10) {
class Repository<T>(initSize: Int = 10) {
private val list =
MutableList<T?>(initSize) { null }
operator fun plusAssign(rv: T) {

View File

@ -4,9 +4,9 @@ files:
visible: true
placeholders:
- offset: 103
length: 740
length: 736
placeholder_text: class Repository
- offset: 858
- offset: 854
length: 833
placeholder_text: |-
/*

View File

@ -1,4 +1,4 @@
// CheckInstructions/Task4.kt
// CheckInstructions/CheckInstructionsSoln4.kt
package checkInstructionsExercise4
import atomictest.*

View File

@ -3,10 +3,10 @@ files:
- name: src/Task.kt
visible: true
placeholders:
- offset: 86
- offset: 103
length: 985
placeholder_text: class Tank
- offset: 1086
- offset: 1103
length: 422
placeholder_text: |-
/*