Create an abstract base class animal

Assignment Help Computer Engineering
Reference no: EM131937089

Assignment

Using Abstract Classes and Methods Create the Java source code files for the classes listed in the inheritance hierarchy displayed in Figure 10-60a. Create a new Java source code file and enter code for the AbstractTest.java test program, as shown in Figure 10-60b. Compile all source code and execute the test program to obtain the output as displayed in Figure 10-60c. 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 an 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.

6. Create a Dog class and a Fish class, both inheriting from Animal.

7. Re-write Abstract Test (Figure 10-60b) as LoopTest.java. Create an arrray of Animal and then loop through the array using an enhanced for(), calling the describe(), sound(), sleep(), and move() methods, successively. Save and then print your source code.

8 Change LoopTest.java to use an Array List instead of an array. Print your source code and indicate whether or not your for() loop had to be modified when changing from an array to an Array List.

580_Figure 10-60a.jpg

2100_Figure 10-60b.jpg

Reference no: EM131937089

Questions Cloud

Create java source code files to implement a callback method : Create the necessary Java source code files to implement a callback method from two child windows to a parent window, as displayed in Figure 10-64.
Create the java source code files for the classes listed : Create the Java source code files for the classes listed in the inheritance hierarchy displayed in Figure 10-63a.
What is the expected annual amount of electricity : What is the expected annual amount of electricity that the plant will generate, in megawatt-hours?
How would you plan a training program : Assume you are the human resource manager of a small seafood company. The general manager has told you that customers have begun complaining about the quality.
Create an abstract base class animal : 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.
How much would you be willing to pay for that security : The required return on security is 10%. how much would you be willing to pay for that security today? Please show work and do not use Excel.
What is the firm wacc : Assume that you are an intern with the Brayton Company, and you have collected the following data: The yield on the company's outstanding bonds is 7.75%.
Pea plant that bred true for green pods : In one experiment, Mendel crossed a pea plant that bred true for green pods with one that bred true for yellow pods. All the F1 plants had green pods.
Compute dollar-weighted rate of return : An investment fund has a balance of $10,000 on Jan 1, 2005. On June 1, 2005, the balance is $11,000.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Provide detailed and measurable functional requirements

Provide detailed and measurable functional requirements. Provide detailed and measurable nonfunctional requirements. List assumptions for the scope of project.

  Prepare a map showing various components of cloud computing

Prepare process map showing the various components of cloud computing and who has responsibility for the implementation and support of the cloud.

  Design an application that allows a user to input a price

Design application that allows a user to input a price until appropriate sentinel value is entered. Output is price of each item on each day, one through seven.

  How the output signal of a single nand gate can be applied

Show how the output signal of a single NAND gate can be applied to 50 other NAND-gate inputs without overloading the output gate. Use buffers to satisfy the fan-out requirements.

  Find how to perform system calls in each operating system

Write a C++ or Java program that reads from one file and writes to another find how to perform system calls in each operating system.

  Determined through default conventions

An advantage of dynamic scoping is that access to nonlocal variables is considerably faster than accesses to nonlocals when static scoping is used.

  Compare rate distortion performances with the one tap case

DPCM-encode the Sinan, Elif, and bookshelf 1 images using a two-tap predictor and a four-level quantizer followed by a Huffman coder.

  Combine the session presentation and application layer

What are advantage of combining the session presentation and application layer in OSI model into one single application layer in the internet m

  How far upstream does the flow from the source reach

In Problem, how far upstream does the flow from the source reach?-  For the case of a source at the origin with a uniform free stream plot the streamline ψ = 0.

  Define what is the look up table

The PIC18F4321 microcontroller is required to input a number from 0 to 9 from an ASCII keyboard interfaced to it and output to an EBCDIC printer.

  Program to determine persons body mass index

Develop a program which determines a person's body mass index. Develop the modular program which determine and display a person's body mass index (BMI).

  Read and follow the directions in creating an archive

How do the algorithm techniques of fragmentation affect the end result of sorting by larger amounts.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd