Question: Please modify the code to do the steps for Abstract.Java, Cat.Java, and Dog.Java AbstractAnimal.java package exercises.inheritence; /** * Represents the parent class. * * @author

Please modify the code to do the steps for Abstract.Java, Cat.Java, and Dog.Java

AbstractAnimal.java

package exercises.inheritence;

/** * Represents the parent class. * * @author * @version 1.0 * */ public abstract class AbstractAnimal {

/** * class field name of animal. */ private String myName;

/** * Parameterized constructor. * * @param theName parameter name */ public AbstractAnimal(final String theName) { this.myName = theName; }

/** * getter for myName. * * @return myName */ public String getMyName() { return myName; }

/** * Setter for myName. * * @param theName parameter. */ public void setMyName(final String theName) { this.myName = theName; } // Q1 create a function walk() -- print animal walks // Q2 create a overloaded function walk with parameter String -- print animal walks + string // Q3 create a abstract function talk()

}

Cat.Java package exercises.inheritence;

import inheritenceExample.Child3;

/** * Represents the child class. * * @author * @version 1.0 * */ public class Cat{

// Q1. extend the AbstractAnimal class // Q2. create a parameterized constructor with theName, it should call superclass // paramterized constructor // Q3. In the main method create an object of cat and call the overloaded walking method // with parameter "slow" // Q4. Add un-implemented abstract method from parent and print "meow". // Q5. call the talk method from main function

}

Dog.Java package exercises.inheritence;

/** * Represents the child class. * * @author * @version 1.0 * */ public class Dog {

// Q1. extend the AbstractAnimal class // Q2. create a parameterized constructor with theName, it should call superclass // paramterized constructor // Q3. In the main method create an object of dog and call the overloaded walking method // with parameter "fast" // Q4. Add un-implemented abstract method from parent and print "Woof". // Q5. call the talk method from main function }

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!