Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package week1;
- public class Bicycle {
- int speed;
- int gear;
- public Bicycle(int speed, int gear) {
- super();
- this.speed = speed;
- this.gear = gear;
- }
- public int getSpeed() {
- return speed;
- }
- public void setSpeed(int speed) {
- this.speed = speed;
- }
- public int getGear() {
- return gear;
- }
- public void setGear(int gear) {
- this.gear = gear;
- }
- public String toString(){
- return "The speed of bicycle"+speed+"\n The gear of the bicycle"+gear;
- }
- }
- package week1;
- public class MountainBicycle extends Bicycle {
- public MountainBicycle(int speed, int gear,int height) {
- super(speed, gear);
- seatHeight= height;
- // TODO Auto-generated constructor stub
- }
- int seatHeight;
- public int getSeatHeight() {
- return seatHeight;
- }
- public void setSeatHeight(int seatHeight) {
- this.seatHeight = seatHeight;
- }
- public String toString(){
- return super.toString()+"Seatheight"+seatHeight;
- }
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement