Skip to content

StreetXHasu/test-before-job-1

Repository files navigation

Task #1: Farm OOP PHP

During the summer, to take a break from the hustle and bustle of the city, you went to Uncle Jack's farm. After a few days of rest, you got bored and decided to practice programming. Walking into the barn, where cows and chickens live, and seeing how the automatic milk and egg collector works, you decided to describe its work in the OOP paradigm.

Given

  • There are 7 cows and 15 chickens living in the barn;
  • A cow can give 8-12 liters of milk per milking;
  • A chicken can lay 0-1 egg per laying;
  • Each cow and chicken has a unique registration number.

Requirement

Implement an object-oriented system using PHP: a prototype of a production collection.

The system should be able to:

  • Add animals to the barn;
  • Collect the production from all animals registered in the barn;
  • Calculate the total amount of collected production.
  • The implementation of a graphical interface is not required.
  • The method of initializing the list of animals is at your discretion.

Script execution result

When running the main.php script in the console:

  • The system should add animals to the barn;
  • Collect the production (milk cows and collect eggs from chickens);
  • Display the total number of collected eggs and liters of milk on the screen.

Recommendations:

  • Implement the task using the OOP approach, by creating classes for the objects involved
  • Write tests to ensure the program's functionality

About

Test task 1 from the interview. Farm OOP PHP

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages