Purchase Solution

Using Abstract Classes and Methods

Not what you're looking for?

Ask Custom Question

****This needs to be written in Java*****

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)

****This needs to be written in Java*****

Purchase this Solution

Solution Summary

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.

Purchase this Solution


Free BrainMass Quizzes
Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.