Compare commits
3 Commits
d48892751d
...
ba07d204c6
Author | SHA1 | Date |
---|---|---|
Kay Faraday | ba07d204c6 | |
Kay Faraday | aff7c6f798 | |
Kay Faraday | dc7f3c54ca |
|
@ -4,4 +4,4 @@ Dead simple tip calculator that computes tip based on the subtotal, pre-tax. It'
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
AGPL 3.0 only, see LICENSE.md.
|
AGPLv3+, see LICENSE.md.
|
||||||
|
|
|
@ -4,12 +4,12 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdk 32
|
namespace "quest.faraday.tip_calculator"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "quest.faraday.tip_calculator"
|
applicationId "quest.faraday.tip_calculator"
|
||||||
minSdk 21
|
minSdk 21
|
||||||
targetSdk 32
|
targetSdk 33
|
||||||
|
compileSdk 33
|
||||||
versionCode 3
|
versionCode 3
|
||||||
versionName "1.0.2"
|
versionName "1.0.2"
|
||||||
|
|
||||||
|
@ -36,7 +36,6 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
||||||
implementation 'androidx.core:core-ktx:1.7.0'
|
implementation 'androidx.core:core-ktx:1.7.0'
|
||||||
implementation 'androidx.appcompat:appcompat:1.5.1'
|
implementation 'androidx.appcompat:appcompat:1.5.1'
|
||||||
implementation 'com.google.android.material:material:1.7.0'
|
implementation 'com.google.android.material:material:1.7.0'
|
||||||
|
|
|
@ -29,7 +29,8 @@ class MainActivity : AppCompatActivity() {
|
||||||
val tax = BigDecimal(binding.taxEdit.text.toString())
|
val tax = BigDecimal(binding.taxEdit.text.toString())
|
||||||
val gratuityCoeff = BigDecimal(binding.gratuityEdit.text.toString())
|
val gratuityCoeff = BigDecimal(binding.gratuityEdit.text.toString())
|
||||||
val tip = gratuityCoeff * subtotal
|
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) {
|
} catch (e: NumberFormatException) {
|
||||||
displayMessage("Invalid number format")
|
displayMessage("Invalid number format")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue