Create class code files that inherit from the parent class


Assignment: Object-Oriented Application

So far, you have learned about design and how to create a simple Java application using an IDE. Now, you are going to gain some experience writing an object-oriented program with classes, objects, inheritance, and polymorphism. These terms sound complex, but you will find they are not difficult to use. You will be drawing on all the information you have gained, and this project will require some time, so start early, and pay attention to instructions.

For this project, you will create a Java program that allows the user to select a category of animal from a menu and then a specific animal in that category, then view information about their selection. To facilitate this, we will use a class and inheritance structure as follows:
Program/Main Class: AnimalInfo. This file is for the code (in the method "Main()") that will run the program, present the list, prompt for input, execute the appropriate class method, and then terminate. Note that this file may not include any information about the categories of animals or any specifics about animals. That information comes from the inheriting classes discussed below.

1) Create a project called "AnimalInfo".

2) Using the method "Main()", present the user with three animals and ask them to select one to learn more about that animal. The animals in the menu must match your "inheriting classes" discussed below.

3) When the user selects an animal from the menu, execute the "displayInfo()" method from the appropriate inheriting class.

4) Use code comments to annotate your source code, indicating what each line of code does as well as how it works.

Parent Class: (Name to be determined.) This file is for the broad category of animals that the user can examine in your program, such as dogs, horses or fish. Your program may contain only one parent class (users will only be able to select from a single category of animals).

1) Create a class file, naming it according to the category of animals that you've decided to use.

2) Do NOT inherit another file/class. (Do not use the "extends" keyword in the class declaration.)

3) Create a method in your class file called "displayInfo()".

4) This displayInfo() method will only be executed if inheritance fails, so in displayInfo(), write code that reports to the screen that this parent class has been engaged by mistake. For example, if executed this method will generate user-friendly text on the screen such as: "Incorrect class inheritance, please contact technical support."

5) Use code comments to annotate your source code, indicating what each line of code does as well as how it works.

Inheriting Classes: (Names to be determined.) Create three class code files that inherit from the parent class discussed above. For example, if you named your parent class "Dogs", then your inheriting class files might be "Bulldog", "Beagle" and "Poodle". (You may not use those examples for your program.)

1) Create three class files, reflecting the animals listed in the menu that was presented to the user.

2) Within each of these class files, declare the class so that it inherits your parent class (using the "extends" keyword).

3) In each class, create a method called "displayInfo()" so that it will override the same method in the parent class. (This will cause text about the selected animal to appear on the screen instead of the error report you wrote for the same method in the parent class.)

4) The text must be a short description of the animal, such as where they live and/or their physical parameters and something interesting about them (1 paragraph of no more than 3-4 sentences). (You do not need to cite your source for this information.)

5) Use code comments to annotate your source code, indicating what each line of code does as well as how it works.

Format your assignment according to the give formatting requirements:

a. The answer must be double spaced, typed, using Times New Roman font (size 12), with one-inch margins on all sides.

b. The response also includes a cover page containing the title of the assignment, the course title, the student's name, and the date. The cover page is not included in the required page length.

c. Also include a reference page. The references and Citations should follow APA format. The reference page is not included in the required page length.

Solution Preview :

Prepared by a verified Expert
Computer Engineering: Create class code files that inherit from the parent class
Reference No:- TGS03028880

Now Priced at $45 (50% Discount)

Recommended (98%)

Rated (4.3/5)