My assignment is to create a program that will give the MPH of a bicycle given the gear (1 - 3)
and cadence (1-100)
.
- 1st gear MPH = cadence/12,
- 2nd gear MPH = cadence/6,
- 3rd gear MPH = cadence/4.
We have set a class and need to run a test program. Here is what I have so far, I am just confused as to where I run the looping structure with user input and where my return statements should be:
public class Bicycle
{
private int bike;
private int gear = 1;
private int cadence = 1;
private int speed = 1;
public void changeGear(int getGear)
{
gear = getGear;
}
public void changeCadence(int getCadence)
{
cadence = getCadence;
}
public void MPH(int getMPH)
{
speed = getMPH;
}
}
Here is my test:
import java.util.Scanner;
public class BicycleTest
{
public static void main(String[] args)
{
Bicycle bike;
bike = new Bicycle();
}
}