GithubHelp home page GithubHelp logo

phpinterview's Introduction

PHP Interview Kata

Code Kata is a term coined by Dave Thomas, co-author of the book The Pragmatic Programmer, in a bow to the Japanese concept of kata in martial arts. A code kata is an exercise in programming which helps a programmer hone their skills through practice and repetition. As of October 2011, Dave Thomas has published 21 different katas.

You can find others to start practicing here.

When you do programming katas, you use TDD. That's why I have included PHPUnit as a dependency.

Exercise: Movie Tickets

Adaptation of codingkata.org's Movie Ticket problem

Description

The computers - if you can call those DOS slaves so - all went down. Worst case scenario. As you are the only clerk who can multiply you are now in charge of handling all ticket sales! Seize the opportunity!

Basic admission rates (regular weekday, 2D movie, <=120 min, parquet)

General admission                               $11.00
Students                                        $8.00
Senior Citizens (65 & older)                    $6.00
Children (under 13)                             $5.50
Group (20 people or more)                       $6.00 each

Exceptions

3D movie                                        +$3.00
Over-length (more than 120 min.)                +$1.50
Movie Day (Thurdsday, except for groups!)       -$2.00
Weekends                                        +$1.50
Loge                                            +$2.00

Customer satisfaction is important, so always charge the lowest price possible!

To solve this exercise, implement the interface provided within src/Kata/Movie.php after you checked out the project code.

Execute tests

  1. Add your code to 'src/Kata/Movie.php' until tests pass, using pricing rules from above exercise notes.

  2. Run 'php ./vendor/bin/phpunit' from your command line to run your tests.

    php vendor/bin/phpunit
    
  3. To start it should look like this

    PHPUnit Fail

  4. And to finish it will look like this:

    PHPUnit Pass

phpinterview's People

Contributors

joelpittet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

drclaw tianvier

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.