I have a project which has 2 inputs 3 outputs PLZ HELP

Hi guys , i ll try to do a project to loan a car which is like this >
use input 2 numbers one for car price other one between 12/24/36 (month)

2 textNumbers =
car price

outputs for user when it click on button it shows this

3 textviews =
processing fee
monthly fee

1 button =
shows all 3 text views

formula is >
val balance = 0.60
val intrest = 0.013
val downpayment = 0.40
val proccessing = 0.55
val f1 = carprice * balance * interest * month

   downpayment = car price * downpayment
   monthly fee = (car price * balance ) + (f1)  / month
   processing fee = car price * balance * processing fee

the first problem is can not multiply 2 numbers even 3 of them like python
the second problem, I did something I got a result in my text view but it shows decimal numbers like if i expect 12000$ downpayment, it shows 120.0000000 downpayment

Please help me :frowning:

Hi Caliburam,

At first glance your problem is that your variable types are unclear. In Kotlin there is no such type as “textNumber”.

In Python you can multiply a string with a number but in Kotlin that is not allowed, you have to convert the text into a number.

There are conversion methods like:


These basic conversions work fine in simple use cases.

However, if you would like to have exact calculation rules (and in a financial application you should have), have a look at BigDecimal. This class provides exact controls over rounding and precision.

As for formatting, there are easy and good solutions. The good one is DecimalFormat which gives you exact control on the number formatting.

I assumed you are writing a mobile application. Kotlin/JS does not have BigDecimal and DecimalFormat as far as I know, there you have to pick a JavaScript library that performs the formatting.


@tothiz Hi thnak you so much ,


I wouldn’t go with float, but if you want and you want it to be formatted properly, use NumberFormat.

1 Like

@tothiz i have done this formula , i got several outputs , but can not find a exact amount of Monthly pay :smiley:

thank you so much