AssigmentS2

This commit is contained in:
k0rrluna 2025-03-01 01:32:49 +03:00
parent ebe1144e25
commit d3ac74eb64
3 changed files with 24 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,19 @@
public class Motorcycle extends Vehicle {
protected String engineType;
public Motorcycle () {
super(2012,"Yamaha");
}
public void setEngineType(String engineType) {
this.engineType = engineType;
}
public String getEngineType() {
return engineType;
}
}

View File

@ -1,11 +1,16 @@
public class demo {
public static void main(String[] args) {
Car car1 = new Car();
Motorcycle motor1 = new Motorcycle();
car1.setYear(2012);
System.out.println(car1.getYear());
System.out.println(car1.getNumDoors());
motor1.setEngineType("Gasoline");
System.out.println(motor1.getEngineType());
}
}