package Zh123;
public class Vehicle {
public String brand;
public String color;
public double speed;
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public double getSpeed() {
return speed;
}
public void setSpeed(double speed) {
this.speed = speed;
}
public String getBrand() {
return brand;
}
public Vehicle(String brand, String color, double speed) {
super();
this.brand = brand;
this.color = color;
this.speed = 0;
}
public Vehicle() {
super();
}
void run() {
System.out.println(brand + "品牌的" + color + "汽车" + "速度为" + speed);
}
}
package Zh123;
public class test {
public static void main(String[] args) {
Vehicle v=new Vehicle("benz","black",0);
v.run();
car c=new car("Hnda","red",0,2);
c.run();
}
}
package Zh123;
public class car extends Vehicle{
public int lader;
public car(String brand, String color, double speed, int lader) {
super(brand, color, speed);
this.lader = lader;
}
public int getLader() {
return lader;
}
public void setLader(int lader) {
this.lader = lader;
}
void run() {
System.out.println("承载着"+lader+"个人"+brand + "品牌的" + color + "汽车" + "速度为" + speed);
}
}
package Zh123;
public abstract class Shape {
public double area;
public double per;
public String color;
public Shape() {
super();
}
public void setColor(String color) {
this.color = color;
}
public abstract void getArea();
public abstract void getPer();
public abstract void showall();
}
package Zh123;
public abstract class Shape {
public double area;
public double per;
public String color;
public Shape() {
super();
}
public void setColor(String color) {
this.color = color;
}
public abstract void getArea();
public abstract void getPer();
public abstract void showall();
}
package Zh123;
public abstract class Shape {
public double area;
public double per;
public String color;
public Shape() {
super();
}
public void setColor(String color) {
this.color = color;
}
public abstract void getArea();
public abstract void getPer();
public abstract void showall();
}
package Zh123;
public abstract class Shape {
public double area;
public double per;
public String color;
public Shape() {
super();
}
public void setColor(String color) {
this.color = color;
}
public abstract void getArea();
public abstract void getPer();
public abstract void showall();
}