Ok first of all I am a new programmer self teaching myself Java using online tutorials on the Oracle site as well as a Learn Java in 21 days book. I have created the bicycle class from the online tutorials and I am trying to manipulate it and see what I can do with it. The following code assumes that speed is in mph and circumference of the tire is in inches. The formula is designed to get the cadence of the tire based upon the circumference and total speed. At the end of the code it is meant to print out the variables as labeled but keeps giving me 0.0 for cadence. Please let me know if a copy of the bicycle class is needed as well. I could also use an explanation on how to get the origin to print out in the (x, y) format as opposed to some strange code it keeps spitting out at me. Please help!!!
import java.util.Scanner; public class Main { /** * @param args */ public static void main(String[] args) { Scanner scn = new Scanner(System.in); Point origin = new Point (0, 0); Rectangle rectOne = new Rectangle (origin, 100, 50); rectOne.move(5, 10); System.out.println ("This is a default rectangle, its origin is " + origin + " and its area is "+ rectOne.getArea()); Bicycle myBike = new Bicycle (0, 0, 1); System.out.println ("It is time to go for a bike ride to check out your bikes functionality." + " First enter the circumference of your wheel: "); int circumference = scn.nextInt(); System.out.println ("The circumference of your wheel is "+ circumference); System.out.println ("Now enter how much you would like to speed up: "); int i = scn.nextInt(); myBike.speedUp(i); int speed = myBike.getSpeed(); double cadence = ((speed/60)*63360)/circumference; Math.round(cadence); System.out.println ("Your current speed is now: " + speed + " and your current cadence is: "+ cadence); }