Fast coding quizz

Projecte

Exercici 1

Exercici 2

Exercici 3

Exercici 4

fun myFunction(value1: Int, value2: Int) {
    var someNumberGreatterThanFive = value1
    var anotherNumberSmallerThanTen = value2
    someNumberGreatterThanFive++
    anotherNumberSmallerThanTen++
    someNumberGreatterThanFive += 1
    anotherNumberSmallerThanTen += 2
    someNumberGreatterThanFive = someNumberGreatterThanFive * anotherNumberSmallerThanTen
    println("someNumberGreatterThanFive = $someNumberGreatterThanFive")
    println("anotherNumberSmallerThanTen = $anotherNumberSmallerThanTen")
}

Exercici 5

El json resultant ha de ser com aquest:

{
  "squadName": "Super hero squad",
  "homeTown": "Metro City",
  "formed": 2016,
  "secretBase": "Super tower",
  "active": true,
  "members": [
    {
      "name": "Molecule Man",
      "age": 29,
      "secretIdentity": "Dan Jukes",
      "shortName": "D",
      "powers": [
        "Radiation resistance",
        "Turning tiny",
        "Radiation blast"
      ]
    },
    {
      "name": "Madame Uppercut",
      "age": 39,
      "secretIdentity": "Jane Wilson",
      "shortName": "J",
      "powers": [
        "Million tonne punch",
        "Damage resistance",
        "Superhuman reflexes"
      ]
    },
    {
      "name": "Eternal Flame",
      "age": 1000000,
      "secretIdentity": "Unknown",
      "shortName": "U",
      "powers": [
        "Immortality",
        "Heat Immunity",
        "Inferno",
        "Teleportation",
        "Interdimensional travel"
      ]
    }
  ]
}

Exercici 6

Tenim la classe TeamForColors amb la funció teamForColors.

fun main(){
    println("Team1" == teamForColors("white", "green"))
    println("Team2" == teamForColors("white", "blue"))
    println("Team3" == teamForColors("white", "brown"))
    println("Team4" == teamForColors("red", "blue"))
    println("Team5" == teamForColors("red", "black"))
    println("Team6" == teamForColors("red", "green"))
    println("Team7" == teamForColors("white", "blue"))
    println("Team8" == teamForColors("white", "black"))
    println("Team9" == teamForColors("white", "green"))
}

Exercici 7

Tenim el fitxer original.xml. Obre'l i modifica'l per a que:

<nearbyStationList>
    <station>55</station>
    <station>58</station>
    <station>59</station>
    <station>63</station>
</nearbyStationList>