Skip to content

Commit 4ed5a3c

Browse files
authored
Add new exercise: line-up (#2595)
1 parent ceb17dd commit 4ed5a3c

File tree

4 files changed

+231
-0
lines changed

4 files changed

+231
-0
lines changed
Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
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 small regular cases and coming to",
7+
"bigger and irregular 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": "f370aae9-7ae7-4247-90ce-e8ff8c6934df",
32+
"description": "format non-exceptional ordinal numeral 5",
33+
"property": "format",
34+
"input": {
35+
"name": "Petronila",
36+
"number": 5
37+
},
38+
"expected": "Petronila, you are the 5th customer we serve today. Thank you!"
39+
},
40+
{
41+
"uuid": "37f10dea-42a2-49de-bb92-0b690b677908",
42+
"description": "format non-exceptional ordinal numeral 6",
43+
"property": "format",
44+
"input": {
45+
"name": "Attakullakulla",
46+
"number": 6
47+
},
48+
"expected": "Attakullakulla, you are the 6th customer we serve today. Thank you!"
49+
},
50+
{
51+
"uuid": "d8dfb9a2-3a1f-4fee-9dae-01af3600054e",
52+
"description": "format non-exceptional ordinal numeral 7",
53+
"property": "format",
54+
"input": {
55+
"name": "Kate",
56+
"number": 7
57+
},
58+
"expected": "Kate, you are the 7th customer we serve today. Thank you!"
59+
},
60+
{
61+
"uuid": "505ec372-1803-42b1-9377-6934890fd055",
62+
"description": "format non-exceptional ordinal numeral 8",
63+
"property": "format",
64+
"input": {
65+
"name": "Maximiliano",
66+
"number": 8
67+
},
68+
"expected": "Maximiliano, you are the 8th customer we serve today. Thank you!"
69+
},
70+
{
71+
"uuid": "8267072d-be1f-4f70-b34a-76b7557a47b9",
72+
"description": "format exceptional ordinal numeral 1",
73+
"property": "format",
74+
"input": {
75+
"name": "Mary",
76+
"number": 1
77+
},
78+
"expected": "Mary, you are the 1st customer we serve today. Thank you!"
79+
},
80+
{
81+
"uuid": "4d8753cb-0364-4b29-84b8-4374a4fa2e3f",
82+
"description": "format exceptional ordinal numeral 2",
83+
"property": "format",
84+
"input": {
85+
"name": "Haruto",
86+
"number": 2
87+
},
88+
"expected": "Haruto, you are the 2nd customer we serve today. Thank you!"
89+
},
90+
{
91+
"uuid": "8d44c223-3a7e-4f48-a0ca-78e67bf98aa7",
92+
"description": "format exceptional ordinal numeral 3",
93+
"property": "format",
94+
"input": {
95+
"name": "Henriette",
96+
"number": 3
97+
},
98+
"expected": "Henriette, you are the 3rd customer we serve today. Thank you!"
99+
},
100+
{
101+
"uuid": "6c4f6c88-b306-4f40-bc78-97cdd583c21a",
102+
"description": "format smallest two digit non-exceptional ordinal numeral 10",
103+
"property": "format",
104+
"input": {
105+
"name": "Alvarez",
106+
"number": 10
107+
},
108+
"expected": "Alvarez, you are the 10th customer we serve today. Thank you!"
109+
},
110+
{
111+
"uuid": "e257a43f-d2b1-457a-97df-25f0923fc62a",
112+
"description": "format non-exceptional ordinal numeral 11",
113+
"property": "format",
114+
"input": {
115+
"name": "Jacqueline",
116+
"number": 11
117+
},
118+
"expected": "Jacqueline, you are the 11th customer we serve today. Thank you!"
119+
},
120+
{
121+
"uuid": "bb1db695-4d64-457f-81b8-4f5a2107e3f4",
122+
"description": "format non-exceptional ordinal numeral 12",
123+
"property": "format",
124+
"input": {
125+
"name": "Juan",
126+
"number": 12
127+
},
128+
"expected": "Juan, you are the 12th customer we serve today. Thank you!"
129+
},
130+
{
131+
"uuid": "60a3187c-9403-4835-97de-4f10ebfd63e2",
132+
"description": "format non-exceptional ordinal numeral 13",
133+
"property": "format",
134+
"input": {
135+
"name": "Patricia",
136+
"number": 13
137+
},
138+
"expected": "Patricia, you are the 13th customer we serve today. Thank you!"
139+
},
140+
{
141+
"uuid": "2bdcebc5-c029-4874-b6cc-e9bec80d603a",
142+
"description": "format exceptional ordinal numeral 21",
143+
"property": "format",
144+
"input": {
145+
"name": "Washi",
146+
"number": 21
147+
},
148+
"expected": "Washi, you are the 21st customer we serve today. Thank you!"
149+
},
150+
{
151+
"uuid": "74ee2317-0295-49d2-baf0-d56bcefa14e3",
152+
"description": "format exceptional ordinal numeral 62",
153+
"property": "format",
154+
"input": {
155+
"name": "Nayra",
156+
"number": 62
157+
},
158+
"expected": "Nayra, you are the 62nd customer we serve today. Thank you!"
159+
},
160+
{
161+
"uuid": "b37c332d-7f68-40e3-8503-e43cbd67a0c4",
162+
"description": "format exceptional ordinal numeral 100",
163+
"property": "format",
164+
"input": {
165+
"name": "John",
166+
"number": 100
167+
},
168+
"expected": "John, you are the 100th customer we serve today. Thank you!"
169+
},
170+
{
171+
"uuid": "0375f250-ce92-4195-9555-00e28ccc4d99",
172+
"description": "format exceptional ordinal numeral 101",
173+
"property": "format",
174+
"input": {
175+
"name": "Zeinab",
176+
"number": 101
177+
},
178+
"expected": "Zeinab, you are the 101st customer we serve today. Thank you!"
179+
},
180+
{
181+
"uuid": "0d8a4974-9a8a-45a4-aca7-a9fb473c9836",
182+
"description": "format non-exceptional ordinal numeral 112",
183+
"property": "format",
184+
"input": {
185+
"name": "Knud",
186+
"number": 112
187+
},
188+
"expected": "Knud, you are the 112th customer we serve today. Thank you!"
189+
},
190+
{
191+
"uuid": "06b62efe-199e-4ce7-970d-4bf73945713f",
192+
"description": "format exceptional ordinal numeral 123",
193+
"property": "format",
194+
"input": {
195+
"name": "Yma",
196+
"number": 123
197+
},
198+
"expected": "Yma, you are the 123rd customer we serve today. Thank you!"
199+
}
200+
]
201+
}

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 using that name and that number as an [ordinal numeral][ordinal-numeral].
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 → `"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: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
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+
Waiting 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.
5+
6+
To make the customers feel special, he does not want the ticket to have only a number on it.
7+
They shall get a proper English sentence with their name and number on 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 = "mk-mxp, based on previous work from Exercism contributors codedge and neenjaw"
4+
source_url = "https://forum.exercism.org/t/new-exercise-ordinal-numbers/19147"

0 commit comments

Comments
 (0)