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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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