subject

For this exercise, you are going to complete the Dog class. The structure has been set up for you, but you will need to complete two constructors (overloaded). The first will take three parameters and assign the values to the instance variables. The method signature should take the name, then age, and finally weight.
The second constructor will only take name then age. For this one, you will assign a value of 0.0 to the dog’s weight.
Once complete, create and print two Dog objects in the DogTester class. The first should use three parameters and the second should only use two parameters.
Sample Output:
Name: Karel
Weight: 15.6
Age: 7
Name: Clover
Weight: 0.0
Age: 9

public class Dog
{
private String name;
private int age;
private double weight;
// Add your constructors here
public String toString(){
return "Name: " + name + "\nWeight: " + weight + "\nAge: " + age;
}
}

public class DogTester
{
public static void main(String[] args)
{
// Start here!
}
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 04:00
Which spereadsheet type will determine how well a bussiness has done over the past year
Answers: 1
question
Computers and Technology, 22.06.2019 15:30
What is a costume plot? why is it important to a film or theater production?
Answers: 2
question
Computers and Technology, 23.06.2019 09:30
Why is an outfitting a workspace with video games in a technology development company considered a strategic use of money
Answers: 1
question
Computers and Technology, 24.06.2019 00:10
Read each statement below. if the statement describes a peer-to-peer network, put a p next to it. if the statement describes a server-based network, put an s next to it. p - peer-to-peer s - server-based
Answers: 1
You know the right answer?
For this exercise, you are going to complete the Dog class. The structure has been set up for you, b...
Questions
question
History, 09.12.2020 22:50
question
Arts, 09.12.2020 22:50
question
Mathematics, 09.12.2020 22:50
question
Mathematics, 09.12.2020 22:50
Questions on the website: 13722367