My attempts at exercism.org
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 44 lines 1.6 kB view raw view rendered
1# Line up 2 3Welcome to Line up on Exercism's PHP Track. 4If you need help running the tests or submitting your code, check out `HELP.md`. 5 6## Introduction 7 8Your friend Yaʻqūb works the counter at a deli in town, slicing, weighing, and wrapping orders for a line of hungry customers that gets longer every day. 9Waiting customers are starting to lose track of who is next, so he wants numbered tickets they can use to track the order in which they arrive. 10 11To make the customers feel special, he does not want the ticket to have only a number on it. 12They shall get a proper English sentence with their name and number on it. 13 14## Instructions 15 16Given a name and a number, your task is to produce a sentence using that name and that number as an [ordinal numeral][ordinal-numeral]. 17Yaʻqūb expects to use numbers from 1 up to 999. 18 19Rules: 20 21- Numbers ending in 1 (unless ending in 11) → `"st"` 22- Numbers ending in 2 (unless ending in 12) → `"nd"` 23- Numbers ending in 3 (unless ending in 13) → `"rd"` 24- All other numbers → `"th"` 25 26Examples: 27 28- `"Mary", 1``"Mary, you are the 1st customer we serve today. Thank you!"` 29- `"John", 12``"John, you are the 12th customer we serve today. Thank you!"` 30- `"Dahir", 162``"Dahir, you are the 162nd customer we serve today. Thank you!"` 31 32[ordinal-numeral]: https://en.wikipedia.org/wiki/Ordinal_numeral 33 34## Source 35 36### Created by 37 38- @codedge 39- @neenjaw 40- @mk-mxp 41 42### Based on 43 44mk-mxp, based on previous work from Exercism contributors codedge and neenjaw - https://forum.exercism.org/t/new-exercise-ordinal-numbers/19147