Please attach the requested programs below as your assignment submission.

Please attach the requested programs below as your assignment submission.

Your assignment is to create a hierarchy of classes representing animals.

The root of the hierarchy should be a class named Animal (in file Animal.java), described in more detail below.

There must be at least two subclasses of Animal (you are welcome to have more than two). If you have no other ideas, you may name the subclasses Pet (Pet.java) and MarineAnimal (MarineAnimal.java), but you are welcome to choose different groups of animals.

Each of your subclasses of Animal must in turn have at least one subclass (it may have more). Each of these sub-sub-classes of Animal must represent a specific animal, such as dog, cat, green turtle, octopus, and so on. In total, you must have at least six of these classes, representing six different kinds of animals. Choose suitable names for each of these animal classes — the TA may award less than full credit if your names are not suitable, so if you choose an unusual animal, make sure an appropriate comment clearly explains why your choice is suitable. It is also your choice which of these animals belongs to which subclass of Animal, but again your score may depend on the appropriateness of your choices and/or on how well your comments explain your choices.

Your Animal class must have at least:

  • An instance variable to represent the animal’s current weight. You can choose the units (grams, kilograms, ounces, pounds, etc). Your code must have a comment saying which units this variable represents.
  • Another instance variable to represent the animal’s weight when fully grown. This variable should use the same units as the previous variable.
  • Another instance variable to represent the animal’s current size. Again, you must both choose and document suitable units.
  • Another instance variable to represent the animal’s size when fully grown. This variable should use the same units as the previous variable.
  • A constructor that takes as parameters the initial values of all four instance variables, and initializes them accordingly.
  • A method eat that eats a certain amount of food, and increases the animal’s weight by 1% of the amount of food (but without ever exceeding the animal’s fully-grown weight), and similarly increases the animal’s size by exactly 1%, again never exceeding the animal’s fully grow size.
  • Accessor methods for each of the animal’s weight and size.

For your immediate subclasses of Animal, you should choose which instance variables (if any) and methods they provide. The same is true for the individual animal classes. The only requirement is that each of these classes must have at least one new instance method not present in any of its superclasses. Again, choose suitable methods. For example, a Pet usually has a name, and a MarineAnimal may or may not breathe air.

As well as its own unique method, each animal or group of animals may override one or more methods from its superclass(es). This is up to you.

You must also create a TestAnimals class with a main method that does all of the following:

  • Create at least two animal objects of each class of each specific animal. Since you are required to create at least six specific animal classes, the test program will have at least twelve animal objects. Animals should be created with a reasonable minimum size and weight.
  • Feed each of the animals at least until it is fully grown. Once the animal is fully grown both in weight and in size, print the animal’s name and how many feedings it took for it to grow to full size and weight.
  • Call at least once each of the methods specific to each of the animal classes.
  • Call at least once each of the methods specific to each of the classes representing groups of animals.

The code in your TestAnimals class need not be all in the main method, and in fact you are encouraged to create and use multiple methods within this class.

Share This Post

Email
WhatsApp
Facebook
Twitter
LinkedIn
Pinterest
Reddit

Order a Similar Paper and get 15% Discount on your First Order

Related Questions

Review the Institute of Medicine’s 2010 report “The Future of

  Review the Institute of Medicine’s 2010 report “The Future of Nursing: Leading Change, Advancing Health.”  750‐1,000 words, discussing the influence of the IOM report on nursing practice. Include the following: Summarize the four messages outlined in the IOM report and explain why these are significant to nursing practice. Discuss

The assessment for this programme is by a short ten-minute

   The assessment for this programme is by a short ten-minute presentation. Prepare a ten-minute presentation that explains: 1. What have been the key learning points of the programme for you? 2. How have you used these in the workplace to bring about change or improvement that has benefited yourself

Explain how the lack of autonomy for APRNs impact patients in rural populations? As a health care professional in an advocacy role, what resources could you utilize to guide you in changing policies t Nursing Assignment Help

Explain how the lack of autonomy for APRNs impact patients in rural populations? As a health care professional in an advocacy role, what resources could you utilize to guide you in changing policies that impact APRNS in your state? Include in your discussion the type of stakeholders and collaborative partners

analyzing a current or historical example where leaders or decision

 analyzing a current or historical example where leaders or decision makers did not demonstrate sufficient empathy or empathic skills related to trauma, culture, and confrontation.   Describe the event. Provide specific examples that illustrate the absence of empathy-related skills. Explain what leaders or decision makers could have done differently. Justify

Requirements: Write a five-page APA report, not including title and

Requirements: Write a five-page APA report, not including title and reference pages answering the questions below. Do not just answer the questions, but use the questions to formulate your report. Your paper should demonstrate thoughtful consideration of the ideas and concepts presented in the course and provide new thoughts and

Policing in America In this course, we have been learning

  Policing in America In this course, we have been learning about the different time periods of policing. Based on the current climate, there is a level of distrust today between the police and the public. Riots, marches, and protests in response to high-profile police shootings have eroded the relationships

WU Parkinsons Disease Case study Nursing Assignment Help

Scenario:  A 67-year-old man presents to the HCP with chief complaint of tremors in his arms. He also has noticed some tremors in his leg as well. The patient is accompanied by his son, who says that his father has become “stiff” and it takes him much longer to perform

Journal Reflection on Topic Ideas Share your topic idea(s) here.

 Journal Reflection on Topic Ideas  Share your topic idea(s) here. Here are some things to consider: Identify a topic in your specialization. (For IT students, Information Technology is not a topic, however, Millennial’s perceptions of smart phone technology could be a topic. These are examples).   What is the cited problem?

Read the following pages in Towards A New Architecture: (65-85

Read the following pages in Towards A New Architecture: (65-85 ) and resp’ond to one (1) of the following prompts (A, B, C) in 100 – 150 words. (pg,1 starts in PDF. 24) WRI’TING PROMPTS: A.  Corbusier alludes to and provides sketches of the Acropolis at Athens including the Parthenon,

Find one library database published article or online article from

Find one library database published article or online article from within the current year. The topic should be on a topic that interest you from one of this week’s assigned chapters from textbook title; Robbins and Judge: Essentials of Organizational Behavior Edition: 14th, Ch 1: What is Organization Behavior? and

Reply 1 he safety of our patients is an important

Reply 1   he safety of our patients is an important aspect of healthcare and is the basis of quality healthcare.  When patients come to the healthcare system there is an expectation of safety and quality healthcare however this is often not realized due to errors caused by healthcare workers.

Revise the paper submitted in Week 3. Literature Review For

Revise the paper submitted in Week 3. Literature Review For Week 5, locate two additional scholarly articles related to your topic. Summarize the articles in your own words and explain how they are related to your topic. Do not use published cases for this section. y. Legal journals may provide

The databases used by the Datacenter Edition servers are experiencing

The databases used by the Datacenter Edition servers are experiencing rapid growth in terms of use and size. Many of the databases are now used across departments. These databases are considered by the Management Council to be one of the company’s best strategic assets. The Management Council wants to consolidate

Health care professionals practice in an environment that is complex,

  Health care professionals practice in an environment that is complex, with many regulations, laws, and standards of practice. Performing an abortion is legal but may not be considered ethical by other health care professionals or members of the public at large. Other ethical dilemmas arise at the end of

AG is a 54-year-old Caucasian male who was referred to

 AG is a 54-year-old Caucasian male who was referred to your clinic… AG is a 54-year-old Caucasian male who was referred to your clinic to establish care after a recent hospitalization after having a seizure related to alcohol withdrawal. He has hypertension and a history of alcohol and cocaine abuse.

Module 4 Assignment 2: Choosing Distribution Channels and Strategies Overview:For

  Module 4 Assignment 2: Choosing Distribution Channels and Strategies Overview:For this assigment, you will create a written deliverable which describes your recommendation for marketing channels and strategies for distribution of a new product. Please follow the instructions below. Your completed document should be in .doc or .docx format and

The Foreign Intelligence and Surveillance Act

Description The Foreign Intelligence and Surveillance Act (FISA) and the Uniting and Strengthening America by Providing Appropriate Tools Required to Intercept and Obstruct Terrorism (USA PATRIOT) Act of 2001 are controversial topics. The events of September 11, 2001 brought reality to the terrorist threat to the United States. As a

Corporate social responsibility is a broad concept. Explain the dimensions

  Corporate social responsibility is a broad concept. Explain the dimensions of social responsibility. What actions should organizations take to maximize each dimension of social responsibility? What is the relationship between social responsibility and organizational success and profitability? What evidence can you provide to support your position? There are several