Create an abstract base class animal the single constructor


Create the Java source code files for the classes listed in the inheritance hierarchy displayed in Figure 10-60a (attached to post). Create a new Java source code file and enter code for the AbstractTest.java test program, as shown in Figure 10-60b (attached to post). Compile all source code and execute the test program to obtain the output as displayed in Figure 10-60c (attached to post). Perform the following steps to complete these tasks:

1. Create an abstract base class, Animal. The single constructor requires a String to indicate the type of animal, which then is stored in an instance variable.

2. Create a concrete class, Cat, which inherits from Animal. Cat has two instance variables, both Strings: name, which has private access and breed, which has protected access.

3. Create a abstract class, Bird, which inherits from Animal. Bird has a single instance variable, breed, of type String with protected access. Bird implements only the required move() method.

4. Create a concrete class, Robin, which inherits from Bird. Robin has a single instance variable, name, of type String with private access. Robin implements the remaining required methods.

5. Compile all source code and execute the test program to obtain the output as displayed in Figure 10-60c (attached to post).

Four files attached:
Figure 10-60a
Figure 10-60b
Figure 10-60c
AbstractTest.java (Figure 10-60b in code)

Attachment:- AbstractTest.zip

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Create an abstract base class animal the single constructor
Reference No:- TGS01250747

Now Priced at $20 (50% Discount)

Recommended (95%)

Rated (4.7/5)