Skip to content

Instantly share code, notes, and snippets.

@fatihhcan
Created July 14, 2020 17:05
Show Gist options
  • Save fatihhcan/e9614f8e5b98c7462cbc3b2c3020eee2 to your computer and use it in GitHub Desktop.
Save fatihhcan/e9614f8e5b98c7462cbc3b2c3020eee2 to your computer and use it in GitHub Desktop.
fun Equals(view: View) {
var newCount=dataView.text.toString()
var result:Double?=null
//when işlemi ile operator butonların işlevlerini sağladık
when(operator){
"/"->{
result=oldCount.toDouble()/newCount.toDouble()
}
"*"->{
result=oldCount.toDouble()*newCount.toDouble()
}
"-"->{
result=oldCount.toDouble()-newCount.toDouble()
}
"+"->{
result=oldCount.toDouble()+newCount.toDouble()
}
}
dataView.setText(result.toString())
newOperator=true
}
fun Ac(view: View) {
dataView.setText("0")
newOperator=true
}
fun Per(view: View) {
//sayi veri tipini double yaptık , edit textin ilk stringe sonra double cevirdik ve 100 e bolduk
var count:Double=dataView.text.toString().toDouble()/100
dataView.setText(count.toString())
newOperator=true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment