Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Systems Analysis And Synthesis Bridging Computer Science And Information Technology

Authors: Barry Dwyer

1st Edition

0128054492, 9780128054499

More Books

Students also viewed these Databases questions

Question

Explain secret warranties and lemon protection.

Answered: 1 week ago

Question

2. Discuss various aspects of the training design process.

Answered: 1 week ago