Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java Create sub classes that inherit properties from a super class. Follow the instructions below. Define a class, with an identifier of Animal, with three
Java
Create sub classes that inherit properties from a super class. Follow the instructions below. Define a class, with an identifier of Animal, with three private member fields: String breed, int numberOfLegs, double weight Define a constructor that takes arguments for the three member fields. Within the constructor, assign the value to each member field of the class using the constructor arguments. Create getters for the member fields. Define one member method: void sleeping() Within sleeping(), display "This animal is currently sleeping." Define a class, with an identifier of Cat, that is a sub class for the Animal class. Define a constructor that takes arguments for the member fields defined in the super class. Within the constructor, assign the value to each member field of the Animal class using the constructor arguments. Remember to use super to set the member fields in the Animal class. Define two member methods: void displaylnformation(), void purring() Within displaylnformation(), display the cat's breed, number of legs, and weight. Remember to use super to get the member methods in the Animal class. Within purring(), display "This cat is currently purring." Define a class, with an identifier of Bird, that is a sub class for the Animal class. Define a constructor that takes arguments for the member fields defined in the super class. Within the constructor, assign the value to each member field of the Animal class using the constructor arguments. Remember to use super to set the member fields in the Animal class. Define two member methods: void displaylnformation(), void flying() Within displaylnformation(), display the bird's breed, number of legs, and weight. Remember to use super to get the member methods in the Animal class. Within flying(), display "This bird is currently flying." Define a class, with an identifier of Lab09, that contains the necessary main member method to run the program. Within the main member method, declare and instantiate an instance of the Cat and Bird class while providing the values for the constructor arguments. Display what the cat is and show that it is purring and sleeping. Display what the bird is and show that it is flying. Showing information about this cat... This cat is a(n) Ocelot, has 4 leg(s), and weighs 30.0 pound(s) . This cat is currently purring. This animal is currently sleeping. Showing information about this bird... This bird is a(n) Parakeet, has 2 leg(s), and weighs 0.1 pound(s). This bird is currently flying. Lab09.java, Animal.java, Cat.java, Bird.java source codeStep 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