Thread: casting help
View Single Post
  #1 (permalink)  
Old 01-13-2009, 11:10 PM
soc86 soc86 is offline
Member
 
Join Date: Oct 2008
Posts: 39
Rep Power: 0
soc86 is on a distinguished road
Default casting help
Can someone help with my code, I have been asked to complete this for uni, I have been asked to keep the variables as the following

double wheelRad;
int fSprocket;
int rSprocket;
double eRad;

what is wrong with my code?



public class BicylceGears{

public static void main (String[]args){
//Below I have declared my variables
double wheelRad;
int fSprocket;
int rSprocket;
double eRad;

System.out.println("Please enter the wheel radius");
wheelRad = UserInput.readDouble;

System.out.println("How many teeth are on the front sprocket?");
fSprocket = UserInput.readInt;

System.out.println("How many teeth are on the rear sprocket?");
rSprocket = UserInput.readInt;

eRad = wheelRad*fSprocket/rSprocket;

System.out.println("The effective radius for raduis "+wheelRad+" and sprockets "+fSprocket+" and "+rSprocket+" is " +double eRad+);

}//end main

}//end class
Reply With Quote