maygapixel

Untitled

Apr 20th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Bicycle implement Vehicle {
  2. private int speed;
  3. private int gear;
  4. public Bicycle (int speed, int gear){
  5.         this.speed = speed;
  6. this.gear = gear;
  7. }
  8. public String toString(){
  9.         return “Speed: ” + speed + “,” + “Gear:”+ gear;
  10. }
  11. public void changeGear(int a){
  12.  
  13.         this.gear = a;
  14.  
  15. }
  16. public void speedUp (int a){
  17.  
  18.         this.speed += a;
  19.  
  20. }
  21. public void applyBrakes (int a){
  22.  
  23.         this.speed -= a;
  24.  
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment