I have an app where i want to implement a chart , i have three values total , death cases and the recovered ones , so the numbers are as follow :
- Total : 14890035
- Death cases : 614124
- Recovered cases : 8943850
what i basically want to do is to calculate the percentage of deaths cases and recovered ones off the total so my chart will only have two percentages ( death and recovered )
- This is what i tried so far but it is not giving me accurate percentages
val main_deaths = intDaaths.times(100).div(intCases).toFloat()
val main_recovered = intRecovered.times(100).div(intCases).toFloat()
my idea was to multiply the death and recovered numbers to 100 and then divide by total number , but i don't know why it is not giving accurate values ( percentages )
any help is appreciated guys , thank you