Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change the languange from indo to english #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions app/src/main/java/com/example/calculatorprpl/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.example.calculatorprpl.R
import kotlinx.android.synthetic.main.activity_main.*

// EKO MUHAMMAD RILO PEMBUDI

class MainActivity : AppCompatActivity() {

Expand All @@ -15,63 +15,63 @@ class MainActivity : AppCompatActivity() {

btnTambah.setOnClickListener {
if (txtNumber1.text.toString().isEmpty() || txtNumber2.text.toString().isEmpty()) {
txtNumber1.setError("Semua input harus diisi!")
txtNumber1.setError("All inputs must be filled!")
} else {
val a = txtNumber1.text.toString().toDouble()
val b = txtNumber2.text.toString().toDouble()
val c = this.tambah(a, b)
val c = this.addition(a, b)
txtHasil.setText(c.toString())
}
}

btnKurangi.setOnClickListener {
if (txtNumber1.text.toString().isEmpty() || txtNumber2.text.toString().isEmpty()) {
txtNumber1.setError("Semua input harus diisi!")
txtNumber1.setError("All inputs must be filled!!")
} else {
val a = txtNumber1.text.toString().toDouble()
val b = txtNumber2.text.toString().toDouble()
val c = this.kurang(a, b)
val c = this.substraction(a, b)
txtHasil.setText(c.toString())
}
}

btnBagi.setOnClickListener {
if (txtNumber1.text.toString().isEmpty() || txtNumber2.text.toString().isEmpty()) {
txtNumber1.setError("Semua input harus diisi!")
txtNumber1.setError("All inputs must be filled!")
} else {
val a = txtNumber1.text.toString().toDouble()
val b = txtNumber2.text.toString().toDouble()
val c = this.bagi(a, b)
val c = this.divided(a, b)
txtHasil.setText(c.toString())
}
}

btnKali.setOnClickListener {
if (txtNumber1.text.toString().isEmpty() || txtNumber2.text.toString().isEmpty()) {
txtNumber1.setError("Semua input harus diisi!")
txtNumber1.setError("All inputs must be filled!")
} else {
val a = txtNumber1.text.toString().toDouble()
val b = txtNumber2.text.toString().toDouble()
val c = this.kali(a, b)
val c = this.multiple(a, b)
txtHasil.setText(c.toString())
}
}

}

fun kurang(a: Double, b: Double): Double {
fun substraction(a: Double, b: Double): Double {
return a - b
}

fun tambah(a: Double, b: Double): Double {
fun addition(a: Double, b: Double): Double {
return a + b
}

fun kali(a: Double, b: Double): Double {
fun multiple(a: Double, b: Double): Double {
return a * b
}

fun bagi(a: Double, b: Double): Double {
fun divided(a: Double, b: Double): Double {
return a / b
}
}
}