Google Interview Question
Software Engineer / DevelopersCountry: United States
The Animal Family can be broadly classified as below sub categories:
> Bird Family
> Mammal Family
> Insect Family
> Fish Family
Animals can be also classified based on many of their characteristics, such as:
> Carnivores vs Herbivores
> Scavengers
> Land vs. Water Animals
> Noctural or Night Animals
> Cold Blooded vs Warm Blooded Animals
> Vertebrates vs. Invertebrates
> Fly / Swim / Run
> Number Of Legs
class Animal {
String Name ;
List <Characteristic> Characteristics ;
.....
};
class Characteristic {
String Name;
...
};
class Carnivores : public Characteristic {
bool isCarnivores ();
...
};
class Legs : public Characteristic {
int NumberOfLegs ();
...
};
For me makes sense to reuse all the effort made in taxonomy, I would create:
module Biology
module Kingdom
module Animalia
.... all other kingdoms
module Phylum
module Chordata
.... all other phylums
module SubPhylum
...
module SuperClass
...
module Class
module Mamalia
.... all other classes
module Order
module Carnivora
.... all other orders
module Family
module Felidae
.... all other families
module Genus
module Panthera
.... all other Genus
module Species
module Tiger
.... would include Panthera, Felidae, Carnivora, Mamalia, Chordata and Animalia.
To ease the process of writing all this code I would try to fetch data from an API or maybe scrapping Wikipedia.
Animals are mainly categorized into two :
(1)Vertebrates: Animals with backbone
(2)Invertebrates:Animals with no backbone (bacteria etc.)
- Serdar January 12, 2014