第十四周JAVA作业

Posted Glame

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了第十四周JAVA作业相关的知识,希望对你有一定的参考价值。

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();

}

以上是关于第十四周JAVA作业的主要内容,如果未能解决你的问题,请参考以下文章

Java第十四周作业

第十四周Java作业

JAVA第十四周作业

Java第十四周作业

Java第十四周作业

第十四周进度条