# ProcessBicycleGears Program Problem

• February 10th, 2011, 02:35 PM
welsh_rocker
ProcessBicycleGears Program Problem
Code :

```// Find effective radius public class ProcessBicycleGears {   public static double PromptAndRead (String prompt) { double input; UserInput.prompt(prompt); input = UserInput.readDouble();   while (input <=0) { System.out.println(" Error invalid data "); input = (int)PromptAndRead (" Please input data again: "); // Prompt and read the rear teeth }   return input; }   public static double CalcEffectiveRadius (double wRadius, int fSprocket, int rSprocket) { double eRad = (wRadius * fSprocket) / rSprocket; // put your local declarations here return eRad; }   public static void main(String[] argv) { int frontSprocket, rearSprocket; double eRadius, wheelRadius, newRadius, ratio; // put your local declarations here   wheelRadius = PromptAndRead(" Type the Radius: "); // Prompt and read the inches   frontSprocket = (int)PromptAndRead (" Type the front teeth: "); // Prompt and read the front teeth   rearSprocket = (int)PromptAndRead (" Type the rear teeth: "); // Prompt and read the rear teeth   eRadius = CalcEffectiveRadius(wheelRadius, frontSprocket, rearSprocket); //Declares effective radius calculation   System.out.println(" Effective radius for " + frontSprocket + " and teeth " + rearSprocket + " is " + eRadius); // Compute and print newRadius = eRadius; //Calculates the new effective radius do { rearSprocket = (int)PromptAndRead (" Type the rear teeth: "); // Prompt and read the rear teeth ratio = eRadius % newRadius; //Declares Ratio Calculation System.out.println(" Effective radis for " + frontSprocket + " and teeth " + rearSprocket + " is " + newRadius + " ratio to previous " + ratio); newRadius = (wheelRadius * frontSprocket) / rearSprocket; newRadius = newRadius; ratio--; //Delcares Output from Loop } while (rearSprocket >0); } // end of main   } // end class```

Hey guys I have to build a program for an assignment that uses 2 constructors for calculations and input I have implemented those features into the program and they run fine, but I am still having problems with the second series of the program that implements a while Do while Loop to do the effective Radius Calculation and out out the overall ratio could someone take a look at my code and tell me where I'm going wrong if possible?
• February 10th, 2011, 02:39 PM
copeg
Re: ProcessBicycleGears Program Problem
Cross posted at ProcessBicycleGears Program Problem. While cross-posting is not against the rules of this forum, I recommend you be forthright in revealing where else your question was posted. For reasons why, see The problems with crossposting
• February 10th, 2011, 02:45 PM
welsh_rocker
Re: ProcessBicycleGears Program Problem
Mods could you delete thisd thread for me :)