1public class Bicycle {
2
3 // the Bicycle class has three fields
4 public int cadence;
5 public int gear;
6 public int speed;
7
8 // the Bicycle class has one constructor
9 public Bicycle(int startCadence, int startSpeed, int startGear) {
10 gear = startGear;
11 cadence = startCadence;
12 speed = startSpeed;
13 }
14
15 // the Bicycle class has four methods
16 public void setCadence(int newValue) {
17 cadence = newValue;
18 }
19
20 public void setGear(int newValue) {
21 gear = newValue;
22 }
23
24 public void applyBrake(int decrement) {
25 speed -= decrement;
26 }
27
28 public void speedUp(int increment) {
29 speed += increment;
30 }
31
32}
33