add amount saved
This commit is contained in:
parent
d48892751d
commit
dc7f3c54ca
|
@ -29,7 +29,8 @@ class MainActivity : AppCompatActivity() {
|
|||
val tax = BigDecimal(binding.taxEdit.text.toString())
|
||||
val gratuityCoeff = BigDecimal(binding.gratuityEdit.text.toString())
|
||||
val tip = gratuityCoeff * subtotal
|
||||
displayMessage("Tip: $${tip}\nTotal: $${subtotal+tax+tip}")
|
||||
val saved = gratuityCoeff * (subtotal + tax) - tip
|
||||
displayMessage("Tip: $${tip}\nTotal: $${subtotal+tax+tip}\nYou saved: $${saved}")
|
||||
} catch (e: NumberFormatException) {
|
||||
displayMessage("Invalid number format")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue