fixed conversion rates and added a few variables

This commit is contained in:
Wyatt J. Miller 2020-09-11 20:04:44 -04:00
parent c87937aba7
commit f39457092e
2 changed files with 21 additions and 1 deletions

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -3,6 +3,8 @@ package com.wyattjmiller.conversionapp
class Conversion(euroResponse: Double = 0.0, kiloResponse: Double = 0.0) { class Conversion(euroResponse: Double = 0.0, kiloResponse: Double = 0.0) {
private var euro: Double = 0.0 private var euro: Double = 0.0
private var kilo: Double = 0.0 private var kilo: Double = 0.0
private var dollar: Double = 0.0
private var mile: Double = 0.0
val euroToDollars: Double val euroToDollars: Double
get() { get() {
@ -14,9 +16,21 @@ class Conversion(euroResponse: Double = 0.0, kiloResponse: Double = 0.0) {
return kilo.times(TO_MILES) return kilo.times(TO_MILES)
} }
val milesToKilos: Double
get() {
return mile.times(TO_KILO)
}
val dollarsToEuros: Double
get() {
return dollar.times(TO_EURO)
}
companion object { companion object {
const val TO_DOLLARS: Double = 0.846956 const val TO_DOLLARS: Double = 1.184632
const val TO_MILES: Double = 0.62137 const val TO_MILES: Double = 0.62137
const val TO_EURO: Double = 0.846956
const val TO_KILO: Double = 1.609344
} }
init { init {