Compare commits

...

3 Commits

Author SHA1 Message Date
Kay Faraday ba07d204c6 relicense to AGPLv3+ 2024-08-03 00:01:23 +00:00
Kay Faraday aff7c6f798 appease Android Studio 2024-08-02 23:48:12 +00:00
Kay Faraday dc7f3c54ca add amount saved 2024-08-02 23:48:01 +00:00
3 changed files with 6 additions and 6 deletions

View File

@ -4,4 +4,4 @@ Dead simple tip calculator that computes tip based on the subtotal, pre-tax. It'
## License
AGPL 3.0 only, see LICENSE.md.
AGPLv3+, see LICENSE.md.

View File

@ -4,12 +4,12 @@ plugins {
}
android {
compileSdk 32
namespace "quest.faraday.tip_calculator"
defaultConfig {
applicationId "quest.faraday.tip_calculator"
minSdk 21
targetSdk 32
targetSdk 33
compileSdk 33
versionCode 3
versionName "1.0.2"
@ -36,7 +36,6 @@ android {
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'

View File

@ -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")
}