Ok so for my assignment, I have to have two String inputs.

For example, "1.021" and "2.51"

And I need to calculate the difference between these strings (biggest number minus smaller). I can only use the data types: short, char, boolen and String. I cannot use int or double. I cannot assume that both strings have similar length or same decimal type.

Finding the biggest number is easy. And my initial idea was to convert the numbers before the decimal to short and then subtracting, then doing the same for numbers after the decimal. However I don't think that it is the proper approach to tackling it.

Given examples, "1.021" and "2.51"

We know, 2 - 1 = 1
and 0.51 - 0.21 = 0.3

BUT, 2.51 - 1.021 = 1.489

So how does one algorithmically solve this? Thanks.

I just realized that my example provided is not clear and wrong.

How about "51.283" and "1.982"

We know 51 - 1 = 50
and 0.982 - 0.283 = 0.699

BUT, 51.283 - 1.982 = 49.301

Thank you