Skip to content
View jeki2007's full-sized avatar

Block or report jeki2007

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Maximum 250 characters. Please don't include any personal information such as legal names or email addresses. Markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
jeki2007/README.md
  • 👋 Hi, I’m @jeki2007
  • 👀 I’m interested in ...
  • 🌱 I’m currently learning ...
  • 💞️ I’m looking to collaborate on ...
  • 📫 How to reach me ...
  • 😄 Pronouns: ...
  • ⚡ Fun fact: ...

Penjumlahan Pengurangan Perkalian Pembagian private lateinit var spinnerOperasi: Spinner private var operasi = "Penjumlahan" spinnerOperasi = findViewById(R.id.spinnerOperasi)

spinnerOperasi.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { override fun onItemSelected(parent: AdapterView<*>, view: View?, position: Int, id: Long) { operasi = parent.getItemAtPosition(position).toString() generateSoalBaru() }

override fun onNothingSelected(parent: AdapterView<*>) {}

} private fun generateSoalBaru() { angka1 = Random.nextInt(1, 20) angka2 = Random.nextInt(1, 20)

when (operasi) {
    "Penjumlahan" -> soalText.text = "Berapakah $angka1 + $angka2?"
    "Pengurangan" -> soalText.text = "Berapakah $angka1 - $angka2?"
    "Perkalian" -> soalText.text = "Berapakah $angka1 × $angka2?"
    "Pembagian" -> {
        angka1 *= angka2  // agar hasilnya bilangan bulat
        soalText.text = "Berapakah $angka1 ÷ $angka2?"
    }
}

} val jawaban = inputJawaban.text.toString().toInt() val hasil = when (operasi) { "Penjumlahan" -> angka1 + angka2 "Pengurangan" -> angka1 - angka2 "Perkalian" -> angka1 * angka2 "Pembagian" -> angka1 / angka2 else -> 0 }

Popular repositories Loading

  1. jeki2007 jeki2007 Public

    Config files for my GitHub profile.

  2. kotlin-by-example kotlin-by-example Public

    Forked from Kotlin/kotlin-by-example

    The sources of Kotlin by Example.