This method returns true if a number is between a number range.

If you want to use float or double values, you can use the same method and replace the int data type to either a float or double.

Here is a simple method for getting the percent of a subtotal from the total. If you noticed in the code, I had to cast both the subtotal and total variables to float before casting the final result to an int.

This is because if you divide two numbers and both are of type int, the result will also be an int. Casting both variables to float before dividing them did the trick.

Related Posts Plugin for WordPress, Blogger...