Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

object oriented programming Write this code in netbeans and the output must be Question 1: Create a JAVA project called Zoo to design and implement

object oriented programming
Write this code in netbeans
image text in transcribed
and the output must be
image text in transcribed
Question 1: Create a JAVA project called Zoo to design and implement a hierarchy to model the different types of animals that encapsulates common attributes and behaviors of all types of animals. Additionally, create a subclass named Mammal to represent a Mammal. A. The superclass Animal should include the following: 1. A protected instance variable species of type String. 2. Two private instance variables; uniqueID of type String and birthYear of type int. 3. A parameterized constructor to initialize the instance variables. 4. Appropriate getter and setter methods for the uniqueID and birthYear variables. The uniqueID attribute must be in the format "AN2345Z" (two letters 'AP' followed by five digits and ends with the letter ' Z '). s. An instance method named display that prints all relevant details of the Animal. B. The subclass Mammal should inherit the instance variables and methods of the Animal class. And it should include the following: 1. Private instance variables for the mammal; furColor: String and numberOfLegs: int. 2. A parameterized constructor to initialize the instance variables. 3. Override the display method to display all details of the Mammal. 4. An instance method called is WarmBlooded that takes a temperature: int parameter. The method should return true if the mammal's temperature range is within [35C42C] and false otherwise. 5. Override the equals method to compare two mammals based on their furColor. The method should return true if the fur colors are the same, and false otherwise. C. Implement a test class (main method only) that performs the following: 1. Create two objects of type Mammal using the parameterized constructor with appropriate initial values of your choice. 2. Call the display method for both objects. 3. Check if the first object is equal to the second object. If the first object is equal to the second object, print "Equal"; otherwise, print "Not Equal". 4. Check and print the result of calling isWarmBlooded for both mammal objects with a tempreture of 37,34. Output Sample: Details of Mammal 1: Species: Lion Unique ID: AN12345Z Birth Year: 2018 Fur Color: Golden Number of Legs: 4 Details of Mammal 2: Species: Elephant Unique ID: AN67890X Birth Year: 2015 Fur Color: Gray Number of Legs: 4 Not Equal Is Lion Warm-Blooded at Is Elephant Warm-Bloode

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Looking for an example of a Audit Risk Analysis memo. Thank you!

Answered: 1 week ago

Question

What was the positive value of Max Weber's model of "bureaucracy?"

Answered: 1 week ago