This is the spec we were set for the posts and poles challenge (what eventually became "The Fencelator"). The HTML and CSS restrictions were in place so we would focus on the PHP, but were allowed to add more front end once the PHP was complete:
PHP Posts and Railings Challenge
Create a PHP application that can calculate the amount of posts and railings required to build a fence of a certain length or that will calculate the length of a fence when you provide the amount of posts and railings.
- Must be built using PHP
- Must have a basic user interface for specifying amount of posts and railings and length of fence
- Must have a minimal front end, no CSS and as little HTML as possible
- Must be able to calculate the length of a fence when provided the amount of posts and the amount of railings
- Must be able to calculate the amount of posts and railings needed when provided the length of fence required
- All fences must start and end with a post and must contain at least 1 railing
- Railings must have a post between them to connect them, posts cannot sit next to other posts
- When calculating the amount of posts and railings needed to cover a certain length fence, the result must span at least the length required, no less
- Fence length results must be displayed in meters with no more than 2 decimal places
- Code must be Unit Tested!
- Code must use functions or OOP (classes)
- A railing is 1.5m long
- A post is 10cm wide