Please attach the requested programs below as your assignment submission

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.

"96% of our customers have reported a 90% and above score. You might want to place an order with us."

Essay Writing Service
Affordable prices

You might be focused on looking for a cheap essay writing service instead of searching for the perfect combination of quality and affordable rates. You need to be aware that a cheap essay does not mean a good essay, as qualified authors estimate their knowledge realistically. At the same time, it is all about balance. We are proud to offer rates among the best on the market and believe every student must have access to effective writing assistance for a cost that he or she finds affordable.

Caring support 24/7

If you need a cheap paper writing service, note that we combine affordable rates with excellent customer support. Our experienced support managers professionally resolve issues that might appear during your collaboration with our service. Apply to them with questions about orders, rates, payments, and more. Contact our managers via our website or email.

Non-plagiarized papers

“Please, write my paper, making it 100% unique.” We understand how vital it is for students to be sure their paper is original and written from scratch. To us, the reputation of a reliable service that offers non-plagiarized texts is vital. We stop collaborating with authors who get caught in plagiarism to avoid confusion. Besides, our customers’ satisfaction rate says it all.

© 2022 Homeworkcrew.com provides writing and research services for limited use only. All the materials from our website should be used with proper references and in accordance with Terms & Conditions.

Scroll to Top