Application: Animal Characteristics In today’s fast-paced world, it is important for programmers to think about potential future changes that impact their programs. One way that software developers can address this concern is by designing programs that are easy to upgrade and are adaptable to new technologies. In this Application, you work toward this goal by writing a program that uses the concept of inheritance to allow for later additions. For this Application: Create a program using the principles of inheritance based on the following scenario: Scenario: The teachers of a local school need a program to teach their students the basics about animals and their characteristics. The teachers want the program to contain a database of animals, from which the teachers can choose animals to add to a list. The list will be displayed on the students’ monitors so they can study the animals and their characteristics. Right now, the teachers want a program that handles only mammals and birds, but in the future they may want to add other types of animals. The teachers also expect the program to run smoothly and be thoroughly tested to handle extraneous input. Create a program that fulfills the specifications outlined in the scenario above. Use the concept of inheritance to allow for later additions to the program. Also use the TDD concepts from Unit 1 to test the program as you go. Follow the steps below to create the program: Create a class Animal with these variables: ? public String kind; ? public String integument; Add these methods: ? public String movement(boolean fast) returns one of the two strings “I walk on four legs.” or “I run on four legs.” depending on whether fast is false or true, respectively. ? public String sound() returns the empty string. Create two classes, Mammal and Bird, each of which extends Animal. In the constructor for Mammal, set the variable integument to the string “hair”. Do not declare the variable again; it has already been declared in Animal. Similarly, in the constructor for Bird, set integument to the string “feathers”. In the Bird class, override the movement method to return either “I walk on two legs.” or “I fly.” depending on the setting of the fast parameter. Use the @Override annotation. Create additional classes to represent specific kinds of animals (each extends either Mammal or Bird). In each class, set the kind variable and override the sound() method. For example, you might create a Duck class, setting the kind to “duck” and overriding the sound() method to return the string “„quack?” (in single quotes). Note: Remember to test the methods as you go. Use the principles of TDD that you examined in Unit 1. The methods you write in this program are simple and only return strings, so they are relatively easy to test. Users should be able to create animals of any kind you have defined (duck, cow, etc.), but you should also prevent the user from creating a “plain” animal, because there’s no such thing. Every animal has to be a specific kind. Do this by writing a factory method in the Animal class—that is, a method to create objects of various animal kinds. Here’s how: ? First, prevent users from creating a “plain” animal by writing a no-argument constructor for Animal, but making it private. ? Second, write a method Animal newInstance(String kind) that takes the desired kind of animal (such as “duck”), calls the constructor for that particular kind of animal, and returns the result. If given an unrecognized string, the method should not crash; it should return null. Your test of the newInstance method must verify that the objects it creates are equal to objects created by calling the appropriate constructor (for instance, new Duck()) directly. Testing equality (that is, calling assertEquals) requires an equals method in the Animal class. There are five different characteristics that should be equal for two animals to be equal—their kinds, their integuments, their slow and fast movem…

Looking for solution of this Assignment?


We deliver quality original papers

Our experts write quality original papers using academic databases.We dont use AI in our work. We refund your money if AI is detected  

Free revisions

We offer our clients multiple free revisions just to ensure you get what you want.

Discounted prices

All our prices are discounted which makes it affordable to you. Use code FIRST15 to get your discount

100% originality

We deliver papers that are written from scratch to deliver 100% originality. Our papers are free from plagiarism and NO similarity.We have ZERO TOLERANCE TO USE OF AI

On-time delivery

We will deliver your paper on time even on short notice or  short deadline, overnight essay or even an urgent essay