/oop-classify-the-animal-kingdom

Applying the four principles of Object-Oriented Programming to model a classification for a school's Biological and science faculty

Primary LanguageJavaScript

Classification-of-The-Animal-Kingdom

Animal Kingdom Classification

An Introductory test on Object-Oriented Programming

Object-oriented programming is a programming paradigm based on the concept of "objects", which can contain data and code. The data is in the form of fields, and the code is in the form of procedures. A common feature of objects is that procedures are attached to them and can access and modify the object's data fields.

Four Principles of Object-Oriented Programming:

1. Inheritance

  • This is a way of expanding an already existing class and extending its properties as well.

2. Abstraction

  • Its a method of representing an entity without showing the implmentation details.

3. Polymorphism

  • Its a way of implementing the same object or methd in multiple forms for different purposes.

4. Encapsulation

  • This is a way of hiding information from being accessible by some classes. Its a way of making private methods.

Running Procedure:

Method 1:

Method 2:

  • Clone the repo oop-classify-the-animal-kingdom.
  • To run the solution, make sure you have nodejs installed.
  • Use the following command in your terminal.
node object-oriented.js
  • You can explore the code however suits you

Sample Output

--> oop-classify-animal-kingdom> node object-oriented.js
CLASSIFICATION OF THE ANIMAL KINGDOM

Bird
Aves {
  animalName: 'Bird',
  classification: 'Aves',
  withBackbone: true,
  warmBlooded: true
}


Cat
Mammal {
  animalName: 'Cat',
  classification: 'Mammal',
  withBackbone: true,
  warmBlooded: true
}


Butterfly
Arthropoda {
  animalName: 'Butterfly',
  classification: 'Arthropoda',
  withoutBackbone: true,
  coldBlooded: true
}


Tilapia
Fish {
  animalName: 'Tilapia',
  classification: 'Fish',
  withBackbone: true,
  coldBlooded: true
}


Toad
Amphibia {
  animalName: 'Toad',
  classification: 'Amphibia',
  withBackbone: true,
  coldBlooded: true
}


Turtle
Reptiles {
  animalName: 'Turtle',
  classification: 'Reptiles',
  withBackbone: true,
  coldBlooded: true
}