Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using the sample files attached as your guide, in this project you will create an inheritance structure in Java. You will create a super class
Using the sample files attached as your guide, in this project you will create an inheritance structure in Java. You will create a super class called BarnYardAnimal.java. This class will have a String instance variable called name. The class will have a constructor that passes in the name of the animal. The class will also have a displayO method that returns, as a string, the name of animal. You will have two subclasses in this structure that inherit from BarnYardAnimal.java. One called Chicken.java and one called Pig.java. Each class will have a String instance variable called sound. The class will have a constructor that passes in a name and sound. The class will have a display0 method that returns, as a string, the type, name, and sound of the animal Start by building the UML class diagram for these classes showing the inheritance relationship. Then construct the classes Once you have finished the classes, write a test program that creates and displays three objects. Make sure that you are using each constructor specified in some way. For extra credit, you can show polymorphism, but please make sure that you point it out in your code. For extra credit, you can also loop to create and display the objects Grading Rubric Criteria UML Class Diagrams correctly specified Classes appropriately named Inheritance correctly indicated Instance variables correctly created Constructors correctly created Methods correctly created Correctly creates three objects Correctly displays three objects TOTAL Points 15 5 5 15 15 15 15 15 100
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started