From f39457092e0c2e000dc2a5dd52de8ca484e4dc44 Mon Sep 17 00:00:00 2001 From: "Wyatt J. Miller" Date: Fri, 11 Sep 2020 20:04:44 -0400 Subject: [PATCH] fixed conversion rates and added a few variables --- .idea/vcs.xml | 6 ++++++ .../com/wyattjmiller/conversionapp/Conversion.kt | 16 +++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 .idea/vcs.xml diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/wyattjmiller/conversionapp/Conversion.kt b/app/src/main/java/com/wyattjmiller/conversionapp/Conversion.kt index 0382140..6a06bd5 100644 --- a/app/src/main/java/com/wyattjmiller/conversionapp/Conversion.kt +++ b/app/src/main/java/com/wyattjmiller/conversionapp/Conversion.kt @@ -3,6 +3,8 @@ package com.wyattjmiller.conversionapp class Conversion(euroResponse: Double = 0.0, kiloResponse: Double = 0.0) { private var euro: Double = 0.0 private var kilo: Double = 0.0 + private var dollar: Double = 0.0 + private var mile: Double = 0.0 val euroToDollars: Double get() { @@ -14,9 +16,21 @@ class Conversion(euroResponse: Double = 0.0, kiloResponse: Double = 0.0) { 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 { - const val TO_DOLLARS: Double = 0.846956 + const val TO_DOLLARS: Double = 1.184632 const val TO_MILES: Double = 0.62137 + const val TO_EURO: Double = 0.846956 + const val TO_KILO: Double = 1.609344 } init {