Skip to content

Commit 2ec2372

Browse files
committed
Add line-up exercise
1 parent 3698399 commit 2ec2372

File tree

4 files changed

+190
-0
lines changed

4 files changed

+190
-0
lines changed
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
{
2+
"exercise": "line-up",
3+
"comments": [
4+
"Names are chosen without Unicode characters to keep the exercise simple. ",
5+
"",
6+
"The tests are ordered starting with the most common case and coming to ",
7+
"more special cases later on. "
8+
],
9+
"cases": [
10+
{
11+
"uuid": "7760d1b8-4864-4db4-953b-0fa7c047dbc0",
12+
"description": "format smallest non-exceptional ordinal numeral 4",
13+
"property": "format",
14+
"input": {
15+
"name": "Gianna",
16+
"number": 4
17+
},
18+
"expected": "Gianna, you are the 4th customer we serve today. Thank you!"
19+
},
20+
{
21+
"uuid": "e8b7c715-6baa-4f7b-8fb3-2fa48044ab7a",
22+
"description": "format greatest single digit non-exceptional ordinal numeral 9",
23+
"property": "format",
24+
"input": {
25+
"name": "Maarten",
26+
"number": 9
27+
},
28+
"expected": "Maarten, you are the 9th customer we serve today. Thank you!"
29+
},
30+
{
31+
"uuid": "8267072d-be1f-4f70-b34a-76b7557a47b9",
32+
"description": "format exceptional ordinal numeral 1",
33+
"property": "format",
34+
"input": {
35+
"name": "Mary",
36+
"number": 1
37+
},
38+
"expected": "Mary, you are the 1st customer we serve today. Thank you!"
39+
},
40+
{
41+
"uuid": "4d8753cb-0364-4b29-84b8-4374a4fa2e3f",
42+
"description": "format exceptional ordinal numeral 2",
43+
"property": "format",
44+
"input": {
45+
"name": "Haruto",
46+
"number": 2
47+
},
48+
"expected": "Haruto, you are the 2nd customer we serve today. Thank you!"
49+
},
50+
{
51+
"uuid": "8d44c223-3a7e-4f48-a0ca-78e67bf98aa7",
52+
"description": "format exceptional ordinal numeral 3",
53+
"property": "format",
54+
"input": {
55+
"name": "Henriette",
56+
"number": 3
57+
},
58+
"expected": "Henriette, you are the 3rd customer we serve today. Thank you!"
59+
},
60+
{
61+
"uuid": "6c4f6c88-b306-4f40-bc78-97cdd583c21a",
62+
"description": "format smallest two digit non-exceptional ordinal numeral 10",
63+
"property": "format",
64+
"input": {
65+
"name": "Alvarez",
66+
"number": 10
67+
},
68+
"expected": "Alvarez, you are the 10th customer we serve today. Thank you!"
69+
},
70+
{
71+
"uuid": "e257a43f-d2b1-457a-97df-25f0923fc62a",
72+
"description": "format non-exceptional ordinal numeral 11",
73+
"property": "format",
74+
"input": {
75+
"name": "Jacqueline",
76+
"number": 11
77+
},
78+
"expected": "Jacqueline, you are the 11th customer we serve today. Thank you!"
79+
},
80+
{
81+
"uuid": "bb1db695-4d64-457f-81b8-4f5a2107e3f4",
82+
"description": "format non-exceptional ordinal numeral 12",
83+
"property": "format",
84+
"input": {
85+
"name": "Juan",
86+
"number": 12
87+
},
88+
"expected": "Juan, you are the 12th customer we serve today. Thank you!"
89+
},
90+
{
91+
"uuid": "60a3187c-9403-4835-97de-4f10ebfd63e2",
92+
"description": "format non-exceptional ordinal numeral 13",
93+
"property": "format",
94+
"input": {
95+
"name": "Patricia",
96+
"number": 13
97+
},
98+
"expected": "Patricia, you are the 13th customer we serve today. Thank you!"
99+
},
100+
{
101+
"uuid": "2bdcebc5-c029-4874-b6cc-e9bec80d603a",
102+
"description": "format exceptional ordinal numeral 21",
103+
"property": "format",
104+
"input": {
105+
"name": "Washi",
106+
"number": 21
107+
},
108+
"expected": "Washi, you are the 21st customer we serve today. Thank you!"
109+
},
110+
{
111+
"uuid": "74ee2317-0295-49d2-baf0-d56bcefa14e3",
112+
"description": "format exceptional ordinal numeral 62",
113+
"property": "format",
114+
"input": {
115+
"name": "Nayra",
116+
"number": 62
117+
},
118+
"expected": "Nayra, you are the 62nd customer we serve today. Thank you!"
119+
},
120+
{
121+
"uuid": "b37c332d-7f68-40e3-8503-e43cbd67a0c4",
122+
"description": "format exceptional ordinal numeral 100",
123+
"property": "format",
124+
"input": {
125+
"name": "John",
126+
"number": 100
127+
},
128+
"expected": "John, you are the 100th customer we serve today. Thank you!"
129+
},
130+
{
131+
"uuid": "0375f250-ce92-4195-9555-00e28ccc4d99",
132+
"description": "format exceptional ordinal numeral 101",
133+
"property": "format",
134+
"input": {
135+
"name": "Zeinab",
136+
"number": 101
137+
},
138+
"expected": "Zeinab, you are the 101st customer we serve today. Thank you!"
139+
},
140+
{
141+
"uuid": "0d8a4974-9a8a-45a4-aca7-a9fb473c9836",
142+
"description": "format non-exceptional ordinal numeral 112",
143+
"property": "format",
144+
"input": {
145+
"name": "Knud",
146+
"number": 112
147+
},
148+
"expected": "Knud, you are the 112th customer we serve today. Thank you!"
149+
},
150+
{
151+
"uuid": "06b62efe-199e-4ce7-970d-4bf73945713f",
152+
"description": "format exceptional ordinal numeral 123",
153+
"property": "format",
154+
"input": {
155+
"name": "Yma",
156+
"number": 123
157+
},
158+
"expected": "Yma, you are the 123rd customer we serve today. Thank you!"
159+
}
160+
]
161+
}

exercises/line-up/instructions.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Instructions
2+
3+
Given a name and a number, your task is to produce a sentence with an [ordinal numeral][ordinal-numeral] to print onto the ticket.
4+
Yaʻqūb expects to use numbers from 1 up to 999.
5+
6+
Rules:
7+
8+
- Numbers ending in 1 (except for 11) → `st`
9+
- Numbers ending in 2 (except for 12) → `nd`
10+
- Numbers ending in 3 (except for 13) → `rd`
11+
- All other numbers not ending in 1, 2, or 3 → `th`
12+
13+
Examples:
14+
15+
- `'Mary', 1``'Mary, you are the 1st customer we serve today. Thank you!'`
16+
- `'John', 12``'John, you are the 12th customer we serve today. Thank you!'`
17+
- `'Dahir', 162``'Dahir, you are the 162nd customer we serve today. Thank you!'`
18+
19+
[ordinal-numeral]: https://en.wikipedia.org/wiki/Ordinal_numeral

exercises/line-up/introduction.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Introduction
2+
3+
Your 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.
4+
He sees that waiting customers start to loose track of who is next, so he wants to have numbered tickets for them to pick when they arrive.
5+
6+
He is a nice person, and so he does not want to have only a number on the ticket. They shall get a proper English sentence with their name and number in it.

exercises/line-up/metadata.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
title = "Line up"
2+
blurb = "Help lining up customers at Yaʻqūb's Deli."
3+
source = "Based on previous work from Exercism contributors codedge and neenjaw"
4+
source_url = "https://en.wikipedia.org/wiki/Ordinal_numeral"

0 commit comments

Comments
 (0)