Hi.
I have an issue with my code:
public class BuildBridge { public static void main(String[] args) { BuildBridge cartas = new BuildBridge(); int res = cartas.howManyCards(1,1); System.out.print(res); } public int howManyCards(int d, int l) { int results = 0; double middle = l/2; double increment = 0.0; while (middle + increment < d) { ++results; increment += middle / results; // } return results; } }
The "increment" and "middle" variables are always zero, never change, even "middle" after the asignation "= l / 2". Only the variable "results" change when the while loop comes.
Hope you can help, me.
Thanks, have a nice day.
Eclipse Standard/SDK
Version: Kepler Release
Build id: 20130614-0229