Question: please post the solution of problem 2 COMP 1230- Computer Programming 2 Assignment #4: Abstract Classes and Interfaces Due Date: October 11th, 2018 (by 11:59

 please post the solution of problem 2 COMP 1230- Computer Programming

please post the solution of problem 2

COMP 1230- Computer Programming 2 Assignment #4: Abstract Classes and Interfaces Due Date: October 11th, 2018 (by 11:59 PM) Each problem should have a separate folder where you save all your Java source files for each problem Problem # (10 marks) t an abstract class called Animal that contains one instance variable of type ods, sound) and movement(). The return type of the methods is b) Create 3 classes that inherit from Animal: Owl, Donkey, and Frog. Add an instance variable, age a) Design and implemen String that stores the name of an animal (name) and appropriate accessor and mutator methods. Include a constructor that stores the name and toString) method to prints the animal's name. The class also has two String (int) to each of these classes. Develop a constructor that invokes the constructor of its parent class with a name and stores an age in each class. Create appropriate accessor and mutator methods for the age. Implement sound and movement methods in each class that return proper information: Owls hoot (sound) and fly (movement); donkeys hee-haw and walk; frogs ribbit and jump Override toString0 methods that returns a string of all information (including sound and movement information n cach c c) Create an that thoroughly tests all methods of the 3 classes described in b). Problem #2 (10 marks) a) Problem #2 is similar to Problem #1 . But the Animal class is a regular class, not an abstract class. b) Add (or modify from Problem #1) the instance variable, name in the Animal class that is now accessible by each child class (Owl, Donkey, and Frog), i.e. we could have a "red tailed hawk The Animal class does not have soundO and movementO methods anymore. Add a get and set methods for the instance variable, name in the Animal class accessible by each c) child class. d) Owls have a wingspan: add that instance variable and a get and set method for it. e) Donkeys have a weight: add that instance variable and a get and set method for it. f) Frogs have a length: add that instance variable and a get and set method for it. g) Create an array of Anim sm, display the details of each animal in the array. (you'll need to modify the Using toString methods from Problem #1) h) Use a cast to access the animals in the array to do sets and gets of wingspan, weight, and length Show that the code works by producing suitable outputs

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!