朋友们帮一下java.的编程

设计一个描述狗信息的类,包含4个属性有:品种、年龄、体重、毛色,2个构造方法:有参构造和无参构造,2个成员方法:啃骨头、喊叫


class Dog {
    private String type;
    private int age;
    private double weight;
    private String color;
    
    protected Dog() {
        super();
    }

    protected Dog(String type, int age, double weight, String color) {
        super();
        this.type = type;
        this.age = age;
        this.weight = weight;
        this.color = color;
    }
    public void eat() {
        System.out.println("狗啃骨头");
    }
    public void shout() {
        System.out.println("狗叫:  汪汪汪");
    }

    @Override
    public String toString() {
        return "Dog [type=" + type + ", age=" + age + ", weight=" + weight + ", color=" + color + "]";
    }
    
}
public class Answer7733787 {
    public static void main(String[] args) {
        
        Dog dog1 = new Dog();
        Dog dog2 = new Dog("金毛",2,20,"黄色");
        System.out.println(dog1);
        dog1.eat();
        System.out.println(dog2);
        dog2.shout();
    }

}

img

package Test10;

public class Dog {
    String varieties;
    int age;
    float weight;
    String coatColor;
    public Dog(String varieties, int age, float weight, String coatColor) {
        super();
        this.varieties = varieties;
        this.age = age;
        this.weight = weight;
        this.coatColor = coatColor;
    }
    public Dog() {
        super();
    }
    public void ken() {
        System.out.println("啃骨头");
    }
    public void han() {
        System.out.println("喊叫");
    }
}