Question: In java with comments Create a Pet class that has attributes name and dob(date of birth), both Strings. Create a default constructor and an overloaded

In java with comments

Create a Pet class that has attributes name and dob(date of birth), both Strings.

Create a default constructor and an overloaded constructor, accessors and mutators (let NetBeans write the accessors and mutators for you).

The class will have a writeOutput method instead of a toString method.

public void writeOutput() { System.out.println( "name: " + name + " Date of Birth: " + dob ; }

Then add a Dog class which is derived from the Pet class. The Dog class has an extra attribute, breed (a String).

I have given you the main program so you can verify it runs correctly.

Make sure your code has:

Pet class, attributes, constructors, mutators, accessors, writeOutput

Outcome Dog class, attribute(Breed), constructors, mutator and accessor (for Breed), writeOutput

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

package l9;

import java.util.ArrayList;

public class L9 {

public static void main(String[] args) { Dog Max = new Dog("Max" ,"12/1/2015", "Poodle"); Pet Sugar = new Pet("Sugar", "2/14/2017"); Dog Louis = new Dog("Louis", "11/2/2010", "Lab"); Dog Peanut = new Dog("Peanut", "4/20/2013", "Beagle"); Pet Kooch = new Pet("Kooch", "3/10/2004"); ArrayList myL = new ArrayList(); myL.add(Max); myL.add(Sugar); myL.add(Louis); myL.add(Peanut); myL.add(Kooch); for(int i = 0; i

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!