summaryrefslogtreecommitdiff
path: root/homework.txt
diff options
context:
space:
mode:
Diffstat (limited to 'homework.txt')
-rw-r--r--homework.txt64
1 files changed, 64 insertions, 0 deletions
diff --git a/homework.txt b/homework.txt
new file mode 100644
index 0000000..50521c5
--- /dev/null
+++ b/homework.txt
@@ -0,0 +1,64 @@
+City Pantry wants a simple program to be written that searches its database of vendors for menu items available given day, time, location and a number of covers. Each vendor has a name, postcode and a maximum number of covers it can serve at any time. Items on vendor menus each have a name, a list of allergies and the advance time needed for ordering the item.
+
+Your task is to write a console application that takes four input parameters:
+
+ filename - input file with the vendors data
+ day - delivery day (dd/mm/yy)
+ time - delivery time in 24h format (hh:mm)
+ location - delivery location (postcode without spaces, e.g. NW43QB)
+ covers - number of people to feed
+
+and prints a list of item names (and item-specific allergens) available for order given the following rules:
+
+ 1. vendor must be in the delivery area, e.g. vendor with a postcode starting "NW" can only deliver to a postcode starting with "NW", etc.
+ 2. vendor must be able to serve the requested number of covers
+ 3. item advance time must be less or equal to the difference between the search time and the actual time of the delivery
+
+The input file is provided in the following EBNF-like text format:
+
+ vendors = { vendor, new line, items, new line } EOF
+ vendor = name, ";", postcode, ";", max covers
+ items = { item, new line }
+ item = name, ";", allergies, ";", advance time
+ name = /[A-Za-z ]*/
+ postcode = /[A-Za-z][A-Za-z0-9]*/
+ max covers = /\d*/
+ advance time = /\d\dh/
+ new line = "\r\n"
+
+
+Here's an example input file:
+
+ Grain and Leaf;E32NY;100
+ Grain salad;nuts;12h
+
+ Wholegrains;SW34DA;20
+ The Classic;gluten;24h
+
+ Ghana Kitchen;NW42QA;40
+ Premium meat selection;;36h
+ Breakfast;gluten,eggs;12h
+
+ Well Kneaded;EC32BA;150
+ Full English breakfast;gluten;24h
+
+
+Calling the application with the above input on 20/10/15 at 12 AM and the parameters "input 21/10/15 11:00 NW43QB 20" would print the following lines:
+
+ Breakfast;gluten,eggs
+
+Or, calling the application with the above input on 20/10/15 at 12 AM and the parameters "input 24/10/15 11:00 NW43QB 20" would print the following lines:
+
+ Premium meat selection;;
+ Breakfast;gluten,eggs
+
+
+Structure your code as if this was a real, production application. You may however choose to provide simplified implementations for some aspects (e.g. in-memory persistence instead of a full database, if you think any persistence is required at all).
+
+State any assumptions you make as comments in the codebase. If any aspects of the above specification is unclear then please also state, as comments in the source, your interpretation of the requirement.
+
+The purpose of the exercise is to evaluate your approach to software development covering among other things elements of Object Oriented Design, Software Design Patterns and Testing. This exercise is not time bounded.
+
+Complete the exercise in PHP. You are free to implement any mechanism for feeding input into your solution (for example, using hard coded data within unit test). You should provide sufficient evidence that your solution is complete by, as a minimum, indicating that it works correctly against the supplied test data.
+
+Please, do not use any external libraries to solve this problem, but you may use external libraries or tools for building or testing purposes. Specifically, you are encouraged to use PHPUnit to test your code. \ No newline at end of file