Git Product home page Git Product logo

remotestar-project's Introduction

Mercury Holidays - Take Home Test

Task Description

Your task is to fill in the stubbed Property Searcher service to return correct results based on the input criteria.

The correct results are defined as such:

  • All room options must be adjacent (and on the same floor) if the number of rooms is more than one.
  • All room options should be returned within the minimum and maximum budget inclusive.
  • Only rooms that are AVAILABLE should be returned.

Examples

Given the following hotels:

Name Available Floor Room No Per Room Price
Hotel A False 1 1 25.80
Hotel A False 1 2 25.80
Hotel A True 1 3 25.80
Hotel A True 1 4 25.80
Hotel A False 1 5 25.80
Hotel A False 2 6 30.10
Hotel A True 2 7 35.00
Hotel B True 1 1 45.80
Hotel B False 1 2 45.80
Hotel B True 1 3 45.80
Hotel B True 1 4 45.80
Hotel B False 1 5 45.80
Hotel B False 2 6 49.00
Hotel B False 2 7 49.00

Example 1

Given a criteria of:

  • Minimum budget £20 per room.
  • Maximum budget £30 per room.
  • Number of rooms required is 2.

We'd expect to see the following results returned:

Name Available Floor Room No Per Room Price
Hotel A True 1 3 25.80
Hotel A True 1 4 25.80

Example 2

Given a criteria of:

  • Minimum budget £30 per room.
  • Maximum budget £50 per room.
  • Number of rooms required is 2.

We'd expect to see the following results returned:

Name Available Floor Room No Per Room Price
Hotel B True 1 3 45.80
Hotel B True 1 4 45.80

Example 3

Given a criteria of:

  • Minimum budget £25 per room.
  • Maximum budget £40 per room.
  • Number of rooms required is 1.

We'd expect to see the following results returned:

Name Available Floor Room No Per Room Price
Hotel A True 1 3 25.80
Hotel A True 1 4 25.80
Hotel A True 2 7 35.00

Instructions

To get you started, we've already provided a stubbed Searcher class with a method search() that accepts a rooms required count, minimum and maximum budget.

We have also provided an add() method that you will use to store properties in-memory such that they will be available in the call to search().

As part of this assignment, we will need to see evidence that you have verified the functionality of your solution.

We have already set up a composer.json file along with PHPUnit.

How to Run the Code

To run this project, you need to have the following installed

  • PHP 8^
  • Composer to install dependencies

Steps in running the Project

  • Open the code in your chosen IDE

  • run composer install (to install dependencies)

  • To run phpcs

    (env)$ php vendor/bin/phpcs --standard=PSR2 ./app

  • To run PHPUnitTest php vendor/bin/phpunit --coverage-text --colors=always

remotestar-project's People

Contributors

theejhay avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.