Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Bicycle implement Vehicle {
- private int speed;
- private int gear;
- public Bicycle (int speed, int gear){
- this.speed = speed;
- this.gear = gear;
- }
- public String toString(){
- return “Speed: ” + speed + “,” + “Gear:”+ gear;
- }
- public void changeGear(int a){
- this.gear = a;
- }
- public void speedUp (int a){
- this.speed += a;
- }
- public void applyBrakes (int a){
- this.speed -= a;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment