I've recently got into Java and I wanted to ask how to extract just the decimal section in order to use that for further calculations
My code basically converts kilometers to miles, and the user inputs the kilometers (so the value is not fixed)
E.G the user inputs 6KM which turns it into 3.728miles. I wanted to extract the .728 so I can convert the decimal miles into yards (E.G 3 Miles and approximately 1281 Yards).
I have downcasted this with
int wholeMileConversion = (int)conversionOutput;
which gives me 3
But I don't know how to extract JUST THE DECIMALS in order to do: wholeYardConversion = decimalOnlyValue * yards
Sorry if it's hard to understand, I will try to explain again if I can.