Get Value Of Ratio Using Java

This method gets the value based on the ratio that you specify. Getting the value for a 1:1 ratio or 2:1 is pretty simple. What if you want to get the value for a 3:2 ratio? Looks complicated? I did have a hard time when I first encountered this when I was making a Craps Java applet game but I managed to create a method workaround for this.

To use this method for a 5:4 ratio with a value of 10, call it like this:

Here is the method code.

Related Posts Plugin for WordPress, Blogger...

Leave a Reply

Your email address will not be published. Required fields are marked *