Question: Java: complete the following class: Complete the following class that models a dog, according to the comments below The dass requires al1 dogs to have

Java: complete the following class: Java: complete the following class: Complete the following class that models a

Complete the following class that models a dog, according to the comments below The dass requires al1 dogs to have a name, but the breed might be unknown, in which case it should be set to null. An int indicating the dog's age in years is also required This value must be non-negative. Each piece of data is represented by a private instance variable. public class Dog { private String name; private String breed; private int agelnYears;//Pre-condition: n is not null, a >= 0 {don't check, just assume) public Dog(String n, String b, int a) { name = n; breed = b; agelnYears = a;}//Write a tasting method that returns a String containing the/ame, breed, and age in order with a comma and a space//between each. If the breed is not known, then the result//contains only the name and age, separated by a comma and a space.//Write an appropriate equals method for this class

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!