Fun With Objects
$30-35 USD
货到付款
**_Description:_**
Old MacDonald had a farm, as the story goes, e-i-e-i-o. And on this farm he had a bunch of Animals specified below, e-i-e-i-o.
Animals:
* 2 Pigs, named; Oscar and Meyer
* 1 Horse, named; Man-of-war
* 3 Sheep, named; Dolly, Shy, and Dolly(to be explained)
* 1 Cow, named; Abunga
Your mission is to write an application (named Lab4yourname) that will create an object for each of Farmer MacDonald’s animals, and to invoke member methods of each,
Methods for all Animals:
* a valid constructor
* String makeSound(); // will return a String with the sound the animal makes
* String whatType(); // will return a String with the type of animal it is
* String toString(); // will show all of the member data values of the object
Member variables for all animals
* String name;
* int age;
* String color;
* One more variable of your choice.
Create 5 user-defined types, and show that you have mastered the ability to create objects of these types. 4 of them will extend from the Abstract (super) class Animal.
For one sheep you will “clone?? it, that is creating a constructor that will take all the information from the first sheep and place its attributes into the third sheep.
You will finally create an array of type Animals within the application and place each of Farmer MacDonald’s animals into the array, and using a for loop, utilizing the _static class member variable_ **animalCount**, print to a single dialog box, each specific animal’s name, type and age. (You may do this with 3 methods, or simply overload the toString method.
## Deliverables
1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
## Platform
windows/any
项目ID: #3042122