subject

Hello why am i getting this errors ? The constructor Dog() is undefined
The constructor GreyHound() is undefined.

Is there something wrong with how i defined my constructors ?

Here's my code :

public class Dog {
// Creating the variables
private String name;
private String color;
private int birthYear;
// Constructor
public Dog(String name, String color, int birthYear) {
}
// Getters and Setters
public void setname(String name){
this. name = name;
}
public String getname(){
return name;
}
public void setcolor(String color){
this. color = color;
}
public String getcolor(){
return color;
}
public void setbirthYear(int birthYear){
this. birthYear = birthYear;
}
public int getbirthYear(){
return birthYear;
}
public void setraces(int i) {
}
}
// creating a subclass named GreyHound
class GreyHound extends Dog {
private int races;

public GreyHound(int races){
this. races = races;

}
public void setraces(int races){
this. races = races;
}
public int getraces(){
return races;
}
}
// create class named Tester

class Tester{
public static void main(String[] args){
Dog d1 = new Dog();
GreyHound d2 = new GreyHound();

d1.setname("Rolf");
d1.setcolor("Black");
d1.setbirthYear(2010);
d2.setraces(13);

Dog d3 = new Dog ("Bruno","Red",2013);
GreyHound d4 = new GreyHound(13);

Dog d5 = new Dog("Roopi","Silver",2014);
GreyHound d6 = new GreyHound(14);

System. out. println("Name: " + d1.getname());
System. out. println("Color: " + d1.getcolor());
System. out. println("Birth Year: " + d1.getbirthYear());

System. out. println("Number of Races: " + d2.getraces());

System. out. println();

System. out. println("Name: " + d3.getname());
System. out. println("Color: " + d3.getcolor());
System. out. println("Birth Year: " + d3.getbirthYear());

System. out. println("Number of Races: " + d4.getraces());

System. out. println();

System. out. println("Name: " + d5.getname());
System. out. println("Color: " + d5.getcolor());
System. out. println("Birth Year: " + d5.getbirthYear());

System. out. println("Number of Races: " + d6.getraces());

}

}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 19:00
If your accelerator suddenly gets stuck what should you do
Answers: 2
question
Computers and Technology, 22.06.2019 20:00
Need asap assignment directions: think of an organization (business, religious institution, volunteer organization, sports team) with which you have been involved. imagine outfitting it with an it infrastructure. prepare a plan for what you would do to support outfitting it. draw a map of a network connecting all the individuals, give them pcs and printers, and lay out the design as best you can. the purpose is to begin working with these concepts, not to build a perfect network.
Answers: 2
question
Computers and Technology, 22.06.2019 21:30
Im doing this last minute and literally none of my neighbors or people that my dad works with use excel so if anyone could me make up an example
Answers: 1
question
Computers and Technology, 23.06.2019 16:30
If i wanted to include a built-in calendar in a document, what option could i select? draw table insert table insert chart quick tables
Answers: 1
You know the right answer?
Hello why am i getting this errors ? The constructor Dog() is undefined
The constructor GreyH...
Questions
question
Mathematics, 01.03.2021 16:40
question
English, 01.03.2021 16:40
question
Mathematics, 01.03.2021 16:40