Hey I'm a total beginner to Java and I could really use some help with this program please!
This is part of the code I wrote. I put a do-while loop but this only takes care of the rootEstimate value, the powerRider value is also changing. Basically I need to end up with my answer for the root Estimate then after I got the answer with the first power, switch to the second power. The powerRider variable is declared as an array. I was thinking of possibly having a loop with an increment encasing the do-while loop which would increase whenever the while part is not met, but I'm not 100% sure how to approach this and some help would be appreciated!
Code:
 function = -n*powerRider + 0.5*(rho*cD*area*(Math.pow(initialRootEstimate,3))) + (cR*m*g*initialRootEstimate);
 derivedFunction = (3/2)*(rho*cD*area*(Math.pow(initialRootEstimate,2))) + (cR*m*g);
 do
 {
  rootEstimate = initialRootEstimate - (function/derivedFunction);
  absDifference = Math.abs(rootEstimate-initalRootEstimate);
  numLoops++;
  initialRootEstimate=rootEstimate;
  }
Thank you!